MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / test_clear

Method test_clear

python/tests/test_dictionary_api.py:35–52  ·  view source on GitHub ↗

Test the clear() method.

(self)

Source from the content-addressed store, hash-verified

33 self.tree[i] = f"value_{i}"
34
35 def test_clear(self):
36 """Test the clear() method."""
37 # Verify tree has data
38 assert len(self.tree) == 10
39 assert 5 in self.tree
40
41 # Clear the tree
42 self.tree.clear()
43
44 # Verify tree is empty
45 assert len(self.tree) == 0
46 assert 5 not in self.tree
47 assert bool(self.tree) == False
48
49 # Verify we can still add data after clearing
50 self.tree[100] = "new_value"
51 assert len(self.tree) == 1
52 assert self.tree[100] == "new_value"
53
54 def test_get_with_default(self):
55 """Test the get() method with default values."""

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected