MCPcopy Index your code
hub / github.com/python/cpython / test_add

Method test_add

Lib/test/test_weakset.py:219–231  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

217 self.assertNotEqual(id(self.s), id(dup))
218
219 def test_add(self):
220 x = ustr('Q')
221 self.s.add(x)
222 self.assertIn(x, self.s)
223 dup = self.s.copy()
224 self.s.add(x)
225 self.assertEqual(self.s, dup)
226 self.assertRaises(TypeError, self.s.add, [])
227 self.fs.add(Foo())
228 support.gc_collect() # For PyPy or other GCs.
229 self.assertTrue(len(self.fs) == 1)
230 self.fs.add(self.obj)
231 self.assertTrue(len(self.fs) == 1)
232
233 def test_remove(self):
234 x = ustr('a')

Callers

nothing calls this directly

Calls 7

assertInMethod · 0.80
assertTrueMethod · 0.80
FooClass · 0.70
addMethod · 0.45
copyMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected