diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2009-07-05 04:22:40 +0000 |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2009-07-05 04:22:40 +0000 |
commit | 0fe799151fc9e485f9c001fa9138e4ca77069b98 (patch) | |
tree | 91498cda1e4d3df688d8c3b80629307c816f7f5a /Lib/test/test_py3kwarn.py | |
parent | e7a0cc2aa86d984691b0612e13020fbce16d9b09 (diff) | |
download | cpython-git-0fe799151fc9e485f9c001fa9138e4ca77069b98.tar.gz |
Issue 2370: Add Python 3 warnings for the removal of operator.isCallable and
operator.sequenceIncludes.
Patch contributed by Jeff Balogh (and updated slightly by me).
Diffstat (limited to 'Lib/test/test_py3kwarn.py')
-rw-r--r-- | Lib/test/test_py3kwarn.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index eb05303c30..a636a49c88 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -279,6 +279,18 @@ class TestPy3KWarnings(unittest.TestCase): def __hash__(self): pass self.assertEqual(len(w.warnings), 0) + def test_operator(self): + from operator import isCallable, sequenceIncludes + + expected_ = ("operator.isCallable() is not supported in 3.x. " + "Use hasattr(obj, '__call__').") + seq_warn = ("operator.sequenceIncludes() is not supported " + "in 3.x. Use operator.contains().") + with check_warnings() as w: + self.assertWarning(isCallable(self), w, callable_warn) + w.reset() + self.assertWarning(sequenceIncludes(range(3), 2), w, seq_warn) + class TestStdlibRemovals(unittest.TestCase): |