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

Method test_weak_valued_dict_update

Lib/test/test_weakref.py:1761–1776  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1759 self.assertIs(v, weakdict.get(k))
1760
1761 def test_weak_valued_dict_update(self):
1762 self.check_update(weakref.WeakValueDictionary,
1763 {1: C(), 'a': C(), C(): C()})
1764 # errors
1765 self.assertRaises(TypeError, weakref.WeakValueDictionary.update)
1766 d = weakref.WeakValueDictionary()
1767 self.assertRaises(TypeError, d.update, {}, {})
1768 self.assertRaises(TypeError, d.update, (), ())
1769 self.assertEqual(list(d.keys()), [])
1770 # special keyword arguments
1771 o = Object(3)
1772 for kw in 'self', 'dict', 'other', 'iterable':
1773 d = weakref.WeakValueDictionary()
1774 d.update(**{kw: o})
1775 self.assertEqual(list(d.keys()), [kw])
1776 self.assertEqual(d[kw], o)
1777
1778 def test_weak_valued_union_operators(self):
1779 a = C()

Callers

nothing calls this directly

Calls 8

check_updateMethod · 0.95
keysMethod · 0.95
updateMethod · 0.95
listClass · 0.85
CClass · 0.70
ObjectClass · 0.70
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected