Example #1
0
 def test_combine_merge_with_status_ready(self):
     status = 'ready'
     old_map = {
         'add': [1, 2],
         'remove': [3, 4, 5],
     }
     op_map = OperationMap()
     op_map['add'] = [6, 7]
     op_map['remove'] = [9]
     op_map.combine(old_map, status)
     self.assertTrue(op_map['add'] == [6, 7, 1, 2])
     self.assertTrue(op_map['remove'] == [9, 3, 4, 5])
Example #2
0
 def test_combine_replace(self):
     status = 'finished'
     old_map = {
         'add': [1, 2],
         'remove': [3, 4, 5],
     }
     op_map = OperationMap()
     op_map['add'] = [6, 7]
     op_map['remove'] = [9]
     op_map.combine(old_map, status)
     self.assertTrue(op_map['add'] == [6, 7])
     self.assertTrue(op_map['remove'] == [9])
Example #3
0
 def test_combine_merge_with_status_rebuilding_2(self):
     status = 'rebuilding'
     old_map = {
         'add': [1, 2],
         'remove': [3, 4, 5],
     }
     op_map = OperationMap()
     op_map['add'] = [1, 3, 6, 7]
     op_map['remove'] = [4, 2]
     op_map.combine(old_map, status)
     self.assertTrue(op_map['add'] == [1, 6, 7])
     self.assertTrue(op_map['remove'] == [4, 5])
Example #4
0
 def test_combine_merge_with_status_ready(self):
     status = 'ready'
     old_map = {
         'add': [1,2],
         'remove': [3,4,5],
     }
     op_map = OperationMap()
     op_map['add'] = [6,7]
     op_map['remove'] = [9]
     op_map.combine(old_map, status)
     self.assertTrue(op_map['add'] == [6,7,1,2])
     self.assertTrue(op_map['remove'] == [9,3,4,5])
Example #5
0
 def test_combine_merge_with_status_rebuilding_2(self):
     status = 'rebuilding'
     old_map = {
         'add': [1,2],
         'remove': [3,4,5],
     }
     op_map = OperationMap()
     op_map['add'] = [1,3,6,7]
     op_map['remove'] = [4,2]
     op_map.combine(old_map, status)
     self.assertTrue(op_map['add'] == [1,6,7])
     self.assertTrue(op_map['remove'] == [4,5])
Example #6
0
 def test_combine_replace(self):
     status = 'finished'
     old_map = {
         'add': [1,2],
         'remove': [3,4,5],
     }
     op_map = OperationMap()
     op_map['add'] = [6,7]
     op_map['remove'] = [9]
     op_map.combine(old_map, status)
     self.assertTrue(op_map['add'] == [6,7])
     self.assertTrue(op_map['remove'] == [9])
Example #7
0
 def test_init_with_lists_3(self):
     list_a = []
     list_b = [1, 2, 3]
     op_map = OperationMap(list_a, list_b)
     self.assertTrue(len(op_map['add']) == 0)
     self.assertTrue(len(op_map['remove']) == 3)
     self.assertTrue(op_map['add'] == [])
     self.assertTrue(op_map['remove'] == [1, 2, 3])
Example #8
0
 def test_init_with_lists_1(self):
     list_a = [1, 2, 3]
     list_b = [3, 4, 5]
     op_map = OperationMap(list_a, list_b)
     self.assertTrue(len(op_map['add']) == 2)
     self.assertTrue(len(op_map['remove']) == 2)
     self.assertTrue(op_map['add'] == [1, 2])
     self.assertTrue(op_map['remove'] == [4, 5])
Example #9
0
 def test_init_with_list(self):
     list_a = [1, 2, 3]
     op_map = OperationMap(list_a)
     self.assertTrue(op_map['add'] == list_a)
     self.assertTrue(len(op_map['remove']) == 0)
Example #10
0
 def test_init_with_empty(self):
     op_map = OperationMap()
     self.assertTrue('add' in op_map)
     self.assertTrue('remove' in op_map)