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

Method test_patch_orderdict

Lib/test/test_unittest/testmock/testpatch.py:2042–2059  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2040 self.assertEqual(foo(), 0)
2041
2042 def test_patch_orderdict(self):
2043 foo = OrderedDict()
2044 foo['a'] = object()
2045 foo['b'] = 'python'
2046
2047 original = foo.copy()
2048 update_values = list(zip('cdefghijklmnopqrstuvwxyz', range(26)))
2049 patched_values = list(foo.items()) + update_values
2050
2051 with patch.dict(foo, OrderedDict(update_values)):
2052 self.assertEqual(list(foo.items()), patched_values)
2053
2054 self.assertEqual(foo, original)
2055
2056 with patch.dict(foo, update_values):
2057 self.assertEqual(list(foo.items()), patched_values)
2058
2059 self.assertEqual(foo, original)
2060
2061 def test_dotted_but_module_not_loaded(self):
2062 # This exercises the AttributeError branch of _dot_lookup.

Callers

nothing calls this directly

Calls 5

copyMethod · 0.95
itemsMethod · 0.95
OrderedDictClass · 0.90
listClass · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected