Beispiel #1
0
 def test_sparse_add_2_empty_dict(self):
     self.assertEqual({}, sparse_add({}, {}))
Beispiel #2
0
 def test_sparse_add_1_empty_dict1(self):
     self.assertEqual({4: 5, 6: 7}, sparse_add({4: 5, 6: 7}, {}))
Beispiel #3
0
 def test_sparse_add_to_zero(self):
     self.assertEqual({}, sparse_add({1: 3}, {1: -3}))
Beispiel #4
0
 def test_sparse_add_some_same_index(self):
     self.assertEqual({1: 3, 2: 11, 5: 5, 6: 6}, sparse_add({1: 3, 5: 2, 6: 3}, {2: 11, 5: 3, 6: 3}))
Beispiel #5
0
 def test_sparse_add_no_same_index(self):
     self.assertEqual({1: 3, 2: 1, 6: 9, 9: 6}, sparse_add({1: 3, 6: 9}, {2: 1, 9: 6}))
Beispiel #6
0
 def test_sparse_add_same_index(self):
     self.assertEqual({1: 2, 7: 3, 9: 7}, sparse_add({1: 1, 7: 2, 9: 3}, {1: 1, 9: 4, 7: 1}))
Beispiel #7
0
 def test_sparse_add_1_empty_dict2(self):
     self.assertEqual({1: 2, 9: 2}, sparse_add({}, {1: 2, 9: 2}))