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

Method test_dict_update

Lib/test/test_capi/test_dict.py:441–458  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

439 # CRASHES dict_next(NULL, 0)
440
441 def test_dict_update(self):
442 # Test PyDict_Update()
443 update = _testlimitedcapi.dict_update
444 for cls1 in DICT_TYPES:
445 for cls2 in ANYDICT_TYPES + MAPPING_TYPES:
446 dct = cls1({'a': 1, 'b': 2})
447 update(dct, cls2({'b': 3, 'c': 4}))
448 self.assertEqual(dct, {'a': 1, 'b': 3, 'c': 4})
449
450 self.assertRaises(AttributeError, update, {}, [])
451 self.assertRaises(AttributeError, update, {}, 42)
452 for test_type in FROZENDICT_TYPES:
453 with self.frozendict_does_not_support('assignment'):
454 update(test_type(), {})
455 for test_type in MAPPING_TYPES + OTHER_TYPES:
456 self.assertRaises(SystemError, update, test_type(), {})
457 self.assertRaises(SystemError, update, {}, NULL)
458 self.assertRaises(SystemError, update, NULL, {})
459
460 def test_dict_merge(self):
461 # Test PyDict_Merge()

Callers

nothing calls this directly

Calls 4

updateFunction · 0.85
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected