Test the clear() method.
(self)
| 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.""" |