def test_reduce(self): lst = MyHashMap(vItem=[1, 2, 3, 4]) self.assertEqual(lst.reduce(lambda a, b: a + b, 0), 10) test_data = [[], ['a'], ['a', 'b']] for e in test_data: lst = MyHashMap() lst.from_list(e) self.assertEqual(lst.reduce(lambda x, _: x + 1, 0), lst.size())
def test_python_len_and_list_size_equality(self, a): lst = MyHashMap(length=len(a) + 10, vItem=a) # lst.from_list(a) # print(a,lst.to_list()) self.assertEqual(lst.size(), len(a))