MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_hamt_collision_3

Method test_hamt_collision_3

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

Source from the content-addressed store, hash-verified

549 self.assertEqual(len(h5), 3)
550
551 def test_hamt_collision_3(self):
552 # Test that iteration works with the deepest tree possible.
553 # https://github.com/python/cpython/issues/93065
554
555 C = HashKey(0b10000000_00000000_00000000_00000000, 'C')
556 D = HashKey(0b10000000_00000000_00000000_00000000, 'D')
557
558 E = HashKey(0b00000000_00000000_00000000_00000000, 'E')
559
560 h = hamt()
561 h = h.set(C, 'C')
562 h = h.set(D, 'D')
563 h = h.set(E, 'E')
564
565 # BitmapNode(size=2 count=1 bitmap=0b1):
566 # NULL:
567 # BitmapNode(size=2 count=1 bitmap=0b1):
568 # NULL:
569 # BitmapNode(size=2 count=1 bitmap=0b1):
570 # NULL:
571 # BitmapNode(size=2 count=1 bitmap=0b1):
572 # NULL:
573 # BitmapNode(size=2 count=1 bitmap=0b1):
574 # NULL:
575 # BitmapNode(size=2 count=1 bitmap=0b1):
576 # NULL:
577 # BitmapNode(size=4 count=2 bitmap=0b101):
578 # <Key name:E hash:0>: 'E'
579 # NULL:
580 # CollisionNode(size=4 id=0x107a24520):
581 # <Key name:C hash:2147483648>: 'C'
582 # <Key name:D hash:2147483648>: 'D'
583
584 self.assertEqual({k.name for k in h.keys()}, {'C', 'D', 'E'})
585
586 @support.requires_resource('cpu')
587 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