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

Method test_hamt_collision_3

Lib/test/test_context.py:764–797  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

762 self.assertEqual(len(h5), 3)
763
764 def test_hamt_collision_3(self):
765 # Test that iteration works with the deepest tree possible.
766 # https://github.com/python/cpython/issues/93065
767
768 C = HashKey(0b10000000_00000000_00000000_00000000, 'C')
769 D = HashKey(0b10000000_00000000_00000000_00000000, 'D')
770
771 E = HashKey(0b00000000_00000000_00000000_00000000, 'E')
772
773 h = hamt()
774 h = h.set(C, 'C')
775 h = h.set(D, 'D')
776 h = h.set(E, 'E')
777
778 # BitmapNode(size=2 count=1 bitmap=0b1):
779 # NULL:
780 # BitmapNode(size=2 count=1 bitmap=0b1):
781 # NULL:
782 # BitmapNode(size=2 count=1 bitmap=0b1):
783 # NULL:
784 # BitmapNode(size=2 count=1 bitmap=0b1):
785 # NULL:
786 # BitmapNode(size=2 count=1 bitmap=0b1):
787 # NULL:
788 # BitmapNode(size=2 count=1 bitmap=0b1):
789 # NULL:
790 # BitmapNode(size=4 count=2 bitmap=0b101):
791 # <Key name:E hash:0>: 'E'
792 # NULL:
793 # CollisionNode(size=4 id=0x107a24520):
794 # <Key name:C hash:2147483648>: 'C'
795 # <Key name:D hash:2147483648>: 'D'
796
797 self.assertEqual({k.name for k in h.keys()}, {'C', 'D', 'E'})
798
799 @support.requires_resource('cpu')
800 def test_hamt_stress(self):

Callers

nothing calls this directly

Calls 4

HashKeyClass · 0.85
setMethod · 0.45
assertEqualMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected