mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
use assert[Not]In where appropriate
This commit is contained in:
parent
8cd0a66a0f
commit
aa98058cc4
86 changed files with 622 additions and 599 deletions
|
@ -201,9 +201,9 @@ class CommonTest(unittest.TestCase):
|
|||
def test_contains(self):
|
||||
u = self.type2test([0, 1, 2])
|
||||
for i in u:
|
||||
self.assert_(i in u)
|
||||
self.assertIn(i, u)
|
||||
for i in min(u)-1, max(u)+1:
|
||||
self.assert_(i not in u)
|
||||
self.assertNotIn(i, u)
|
||||
|
||||
self.assertRaises(TypeError, u.__contains__)
|
||||
|
||||
|
@ -215,8 +215,8 @@ class CommonTest(unittest.TestCase):
|
|||
def __eq__(self, other):
|
||||
return True
|
||||
__hash__ = None # Can't meet hash invariant requirements
|
||||
self.assert_(AllEq() not in self.type2test([]))
|
||||
self.assert_(AllEq() in self.type2test([1]))
|
||||
self.assertNotIn(AllEq(), self.type2test([]))
|
||||
self.assertIn(AllEq(), self.type2test([1]))
|
||||
|
||||
def test_contains_order(self):
|
||||
# Sequences must test in-order. If a rich comparison has side
|
||||
|
@ -229,7 +229,7 @@ class CommonTest(unittest.TestCase):
|
|||
raise DoNotTestEq
|
||||
|
||||
checkfirst = self.type2test([1, StopCompares()])
|
||||
self.assert_(1 in checkfirst)
|
||||
self.assertIn(1, checkfirst)
|
||||
checklast = self.type2test([StopCompares(), 1])
|
||||
self.assertRaises(DoNotTestEq, checklast.__contains__, 1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue