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

Method test_unorderable_items_views

Lib/test/test_pprint.py:682–692  ·  view source on GitHub ↗

Check that views with unorderable items have stable sorting.

(self)

Source from the content-addressed store, hash-verified

680 "{1: dict_values([{...}])}")
681
682 def test_unorderable_items_views(self):
683 """Check that views with unorderable items have stable sorting."""
684 d = dict((((3+1j), 3), ((1+1j), (1+0j)), (1j, 0j), (500, None), (499, None)))
685 iv = ItemsView(d)
686 self.assertEqual(pprint.pformat(iv),
687 pprint.pformat(iv))
688 self.assertTrue(pprint.pformat(iv).endswith(", 499: None, 500: None})"),
689 pprint.pformat(iv))
690 self.assertEqual(pprint.pformat(d.items()), # Won't be equal unless _safe_tuple
691 pprint.pformat(d.items())) # is used in _safe_repr
692 self.assertTrue(pprint.pformat(d.items()).endswith(", (499, None), (500, None)])"))
693
694 def test_mapping_view_subclass_no_mapping(self):
695 class BMV(MappingView):

Callers

nothing calls this directly

Calls 6

ItemsViewClass · 0.90
pformatMethod · 0.80
assertTrueMethod · 0.80
assertEqualMethod · 0.45
endswithMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected