def test_clear(self): """ A cleared HashTable has an empty data array. """ h = HashTable(3) h['foo'] = 'bar' h.clear() self.assertEqual([[], [], []], h.data)
def test_clear(self): table = HashTable() table.insert('key1', 1) table.insert('key2', 2) table.insert('key3', 3) self.assertEqual(len(table), 3) table.clear() self.assertEqual(len(table), 0) self.assertEqual(table.table, [None] * table.capacity)