diff options
Diffstat (limited to 'Lib/test/test_weakset.py')
-rw-r--r-- | Lib/test/test_weakset.py | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/Lib/test/test_weakset.py b/Lib/test/test_weakset.py index 4d54576..651efe2 100644 --- a/Lib/test/test_weakset.py +++ b/Lib/test/test_weakset.py @@ -33,7 +33,7 @@ class TestWeakSet(unittest.TestCase): for method in dir(set): if method == 'test_c_api' or method.startswith('_'): continue - self.assert_(method in weaksetmethods, + self.assertTrue(method in weaksetmethods, "WeakSet missing method " + method) def test_new_or_init(self): @@ -49,9 +49,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.assert_(self.obj in self.fs) + self.assertTrue(self.obj in self.fs) del self.obj - self.assert_(ustr('F') not in self.fs) + self.assertTrue(ustr('F') not in self.fs) def test_union(self): u = self.s.union(self.items2) @@ -81,8 +81,8 @@ class TestWeakSet(unittest.TestCase): self.assertEqual(self.s.intersection(C(self.items2)), x) def test_isdisjoint(self): - self.assert_(self.s.isdisjoint(WeakSet(self.items2))) - self.assert_(not self.s.isdisjoint(WeakSet(self.letters))) + self.assertTrue(self.s.isdisjoint(WeakSet(self.items2))) + self.assertTrue(not self.s.isdisjoint(WeakSet(self.letters))) def test_and(self): i = self.s.intersection(self.items2) @@ -118,19 +118,19 @@ class TestWeakSet(unittest.TestCase): def test_sub_and_super(self): pl, ql, rl = map(lambda s: [ustr(c) for c in s], ['ab', 'abcde', 'def']) p, q, r = map(WeakSet, (pl, ql, rl)) - self.assert_(p < q) - self.assert_(p <= q) - self.assert_(q <= q) - self.assert_(q > p) - self.assert_(q >= p) - self.failIf(q < r) - self.failIf(q <= r) - self.failIf(q > r) - self.failIf(q >= r) - self.assert_(set('a').issubset('abc')) - self.assert_(set('abc').issuperset('a')) - self.failIf(set('a').issubset('cbs')) - self.failIf(set('cbs').issuperset('a')) + self.assertTrue(p < q) + self.assertTrue(p <= q) + self.assertTrue(q <= q) + self.assertTrue(q > p) + self.assertTrue(q >= p) + self.assertFalse(q < r) + self.assertFalse(q <= r) + self.assertFalse(q > r) + self.assertFalse(q >= r) + self.assertTrue(set('a').issubset('abc')) + self.assertTrue(set('abc').issuperset('a')) + self.assertFalse(set('a').issubset('cbs')) + self.assertFalse(set('cbs').issuperset('a')) def test_gc(self): # Create a nest of cycles to exercise overall ref count check @@ -148,7 +148,7 @@ class TestWeakSet(unittest.TestCase): s=H() f=set() f.add(s) - self.assert_(s in f) + self.assertTrue(s in f) f.remove(s) f.add(s) f.discard(s) @@ -183,79 +183,79 @@ class TestWeakSet(unittest.TestCase): def test_add(self): x = ustr('Q') self.s.add(x) - self.assert_(x in self.s) + self.assertTrue(x in self.s) dup = self.s.copy() self.s.add(x) self.assertEqual(self.s, dup) self.assertRaises(TypeError, self.s.add, []) self.fs.add(Foo()) - self.assert_(len(self.fs) == 1) + self.assertTrue(len(self.fs) == 1) self.fs.add(self.obj) - self.assert_(len(self.fs) == 1) + self.assertTrue(len(self.fs) == 1) def test_remove(self): x = ustr('a') self.s.remove(x) - self.assert_(x not in self.s) + self.assertTrue(x not in 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.assert_(a not in self.s) + self.assertTrue(a not in 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.assert_(elem not in self.s) + self.assertTrue(elem not in 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.assert_(c in self.s) + self.assertTrue(c in 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.assert_(c in self.s) + self.assertTrue(c in self.s) def test_ior(self): self.s |= set(self.items2) for c in (self.items + self.items2): - self.assert_(c in self.s) + self.assertTrue(c in 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.assert_(c in self.s) + self.assertTrue(c in self.s) else: - self.assert_(c not in self.s) + self.assertTrue(c not in 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.assert_(c in self.s) + self.assertTrue(c in self.s) else: - self.assert_(c not in self.s) + self.assertTrue(c not in 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.assert_(c in self.s) + self.assertTrue(c in self.s) else: - self.assert_(c not in self.s) + self.assertTrue(c not in self.s) self.assertRaises(TypeError, self.s.difference_update, [[]]) self.assertRaises(TypeError, self.s.symmetric_difference_update, [[]]) @@ -263,27 +263,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.assert_(c in self.s) + self.assertTrue(c in self.s) else: - self.assert_(c not in self.s) + self.assertTrue(c not in 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.assert_(c in self.s) + self.assertTrue(c in self.s) else: - self.assert_(c not in self.s) + self.assertTrue(c not in 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.assert_(c in self.s) + self.assertTrue(c in self.s) else: - self.assert_(c not in self.s) + self.assertTrue(c not in self.s) def test_inplace_on_self(self): t = self.s.copy() |