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

Method test_nested_views

Lib/test/test_pprint.py:665–680  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

663 ValuesView.__name__ + joined_items)
664
665 def test_nested_views(self):
666 d = {1: MappingView({1: MappingView({1: MappingView({1: 2})})})}
667 self.assertEqual(repr(d),
668 "{1: MappingView({1: MappingView({1: MappingView({1: 2})})})}")
669 self.assertEqual(pprint.pformat(d),
670 "{1: MappingView({1: MappingView({1: MappingView({1: 2})})})}")
671 self.assertEqual(pprint.pformat(d, depth=2),
672 "{1: MappingView({1: {...}})}")
673 d = {}
674 d1 = {1: d.values()}
675 d2 = {1: d1.values()}
676 d3 = {1: d2.values()}
677 self.assertEqual(pprint.pformat(d3),
678 "{1: dict_values([dict_values([dict_values([])])])}")
679 self.assertEqual(pprint.pformat(d3, depth=2),
680 "{1: dict_values([{...}])}")
681
682 def test_unorderable_items_views(self):
683 """Check that views with unorderable items have stable sorting."""

Callers

nothing calls this directly

Calls 4

MappingViewClass · 0.90
pformatMethod · 0.80
assertEqualMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected