mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
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).
This commit is contained in:
parent
e7a0cc2aa8
commit
0fe799151f
2 changed files with 33 additions and 2 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue