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

Method test_hamt_delete_4

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

Source from the content-addressed store, hash-verified

807 self.assertEqual(h.get(B), 'b')
808
809 def test_hamt_delete_4(self):
810 A = HashKey(100, 'A')
811 B = HashKey(101, 'B')
812 C = HashKey(100100, 'C')
813 D = HashKey(100100, 'D')
814 E = HashKey(100100, 'E')
815
816 h = hamt()
817 h = h.set(A, 'a')
818 h = h.set(B, 'b')
819 h = h.set(C, 'c')
820 h = h.set(D, 'd')
821 h = h.set(E, 'e')
822
823 orig_len = len(h)
824
825 # BitmapNode(size=4 bitmap=0b110000):
826 # NULL:
827 # BitmapNode(size=4 bitmap=0b1000000000000000000001000):
828 # <Key name:A hash:100>: 'a'
829 # NULL:
830 # CollisionNode(size=6 id=0x10515ef30):
831 # <Key name:C hash:100100>: 'c'
832 # <Key name:D hash:100100>: 'd'
833 # <Key name:E hash:100100>: 'e'
834 # <Key name:B hash:101>: 'b'
835
836 h = h.delete(D)
837 self.assertEqual(len(h), orig_len - 1)
838
839 h = h.delete(E)
840 self.assertEqual(len(h), orig_len - 2)
841
842 h = h.delete(C)
843 self.assertEqual(len(h), orig_len - 3)
844
845 h = h.delete(A)
846 self.assertEqual(len(h), orig_len - 4)
847
848 h = h.delete(B)
849 self.assertEqual(len(h), 0)
850
851 def test_hamt_delete_5(self):
852 h = hamt()

Callers

nothing calls this directly

Calls 5

HashKeyClass · 0.85
lenFunction · 0.85
setMethod · 0.45
deleteMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected