summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_weakset.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-01-19 00:09:57 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-01-19 00:09:57 (GMT)
commit577473fe687b38c8f01b0c372d6d2563680045b3 (patch)
treeee7dc210c7c5281cf07add09a9cb451758e91716 /Lib/test/test_weakset.py
parenta69ba65fdce3be6f55634b47cc56cf1f962f6cbc (diff)
downloadcpython-577473fe687b38c8f01b0c372d6d2563680045b3.zip
cpython-577473fe687b38c8f01b0c372d6d2563680045b3.tar.gz
cpython-577473fe687b38c8f01b0c372d6d2563680045b3.tar.bz2
use assert[Not]In where appropriate
A patch from Dave Malcolm.
Diffstat (limited to 'Lib/test/test_weakset.py')
-rw-r--r--Lib/test/test_weakset.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/Lib/test/test_weakset.py b/Lib/test/test_weakset.py
index 4e0aa38..0136d75 100644
--- a/Lib/test/test_weakset.py
+++ b/Lib/test/test_weakset.py
@@ -51,9 +51,9 @@ class TestWeakSet(unittest.TestCase):
for c in self.letters:
self.assertEqual(c in self.s, c in self.d)
self.assertRaises(TypeError, self.s.__contains__, [[]])
- self.assertTrue(self.obj in self.fs)
+ self.assertIn(self.obj, self.fs)
del self.obj
- self.assertTrue(ustr('F') not in self.fs)
+ self.assertNotIn(ustr('F'), self.fs)
def test_union(self):
u = self.s.union(self.items2)
@@ -150,7 +150,7 @@ class TestWeakSet(unittest.TestCase):
s=H()
f=set()
f.add(s)
- self.assertTrue(s in f)
+ self.assertIn(s, f)
f.remove(s)
f.add(s)
f.discard(s)
@@ -185,7 +185,7 @@ class TestWeakSet(unittest.TestCase):
def test_add(self):
x = ustr('Q')
self.s.add(x)
- self.assertTrue(x in self.s)
+ self.assertIn(x, self.s)
dup = self.s.copy()
self.s.add(x)
self.assertEqual(self.s, dup)
@@ -198,66 +198,66 @@ class TestWeakSet(unittest.TestCase):
def test_remove(self):
x = ustr('a')
self.s.remove(x)
- self.assertTrue(x not in self.s)
+ self.assertNotIn(x, self.s)
self.assertRaises(KeyError, self.s.remove, x)
self.assertRaises(TypeError, self.s.remove, [])
def test_discard(self):
a, q = ustr('a'), ustr('Q')
self.s.discard(a)
- self.assertTrue(a not in self.s)
+ self.assertNotIn(a, self.s)
self.s.discard(q)
self.assertRaises(TypeError, self.s.discard, [])
def test_pop(self):
for i in range(len(self.s)):
elem = self.s.pop()
- self.assertTrue(elem not in self.s)
+ self.assertNotIn(elem, self.s)
self.assertRaises(KeyError, self.s.pop)
def test_update(self):
retval = self.s.update(self.items2)
self.assertEqual(retval, None)
for c in (self.items + self.items2):
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
self.assertRaises(TypeError, self.s.update, [[]])
def test_update_set(self):
self.s.update(set(self.items2))
for c in (self.items + self.items2):
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
def test_ior(self):
self.s |= set(self.items2)
for c in (self.items + self.items2):
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
def test_intersection_update(self):
retval = self.s.intersection_update(self.items2)
self.assertEqual(retval, None)
for c in (self.items + self.items2):
if c in self.items2 and c in self.items:
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
else:
- self.assertTrue(c not in self.s)
+ self.assertNotIn(c, self.s)
self.assertRaises(TypeError, self.s.intersection_update, [[]])
def test_iand(self):
self.s &= set(self.items2)
for c in (self.items + self.items2):
if c in self.items2 and c in self.items:
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
else:
- self.assertTrue(c not in self.s)
+ self.assertNotIn(c, self.s)
def test_difference_update(self):
retval = self.s.difference_update(self.items2)
self.assertEqual(retval, None)
for c in (self.items + self.items2):
if c in self.items and c not in self.items2:
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
else:
- self.assertTrue(c not in self.s)
+ self.assertNotIn(c, self.s)
self.assertRaises(TypeError, self.s.difference_update, [[]])
self.assertRaises(TypeError, self.s.symmetric_difference_update, [[]])
@@ -265,27 +265,27 @@ class TestWeakSet(unittest.TestCase):
self.s -= set(self.items2)
for c in (self.items + self.items2):
if c in self.items and c not in self.items2:
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
else:
- self.assertTrue(c not in self.s)
+ self.assertNotIn(c, self.s)
def test_symmetric_difference_update(self):
retval = self.s.symmetric_difference_update(self.items2)
self.assertEqual(retval, None)
for c in (self.items + self.items2):
if (c in self.items) ^ (c in self.items2):
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
else:
- self.assertTrue(c not in self.s)
+ self.assertNotIn(c, self.s)
self.assertRaises(TypeError, self.s.symmetric_difference_update, [[]])
def test_ixor(self):
self.s ^= set(self.items2)
for c in (self.items + self.items2):
if (c in self.items) ^ (c in self.items2):
- self.assertTrue(c in self.s)
+ self.assertIn(c, self.s)
else:
- self.assertTrue(c not in self.s)
+ self.assertNotIn(c, self.s)
def test_inplace_on_self(self):
t = self.s.copy()
@@ -348,7 +348,7 @@ class TestWeakSet(unittest.TestCase):
self.assertFalse(u in s)
with testcontext() as u:
s.add(u)
- self.assertTrue(u in s)
+ self.assertIn(u, s)
t = s.copy()
with testcontext() as u:
s.update(t)