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

Method test_yaml_linkage

Lib/test/test_ordered_dict.py:340–348  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

338 check(OrderedDict(od))
339
340 def test_yaml_linkage(self):
341 OrderedDict = self.OrderedDict
342 # Verify that __reduce__ is setup in a way that supports PyYAML's dump() feature.
343 # In yaml, lists are native but tuples are not.
344 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
345 od = OrderedDict(pairs)
346 # yaml.dump(od) -->
347 # '!!python/object/apply:__main__.OrderedDict\n- - [a, 1]\n - [b, 2]\n'
348 self.assertTrue(all(type(pair)==list for pair in od.__reduce__()[1]))
349
350 def test_reduce_not_too_fat(self):
351 OrderedDict = self.OrderedDict

Callers

nothing calls this directly

Calls 3

__reduce__Method · 0.95
assertTrueMethod · 0.80
OrderedDictClass · 0.70

Tested by

no test coverage detected