Beispiel #1
0
def test_active_index_list_empty():
    # Empty list
    active_list_obj = ActiveList()
    mode = active_list_obj.getMode()
    assert mode == ActiveMode.ALL_ACTIVE
    list1 = active_list_obj.get_active_index_list()
    assert len(list1) == 0
Beispiel #2
0
def test_active_index_list_add_active():
    # add elements, mode is changed to partly active
    active_list_obj = ActiveList()
    assign_list = [0, 1, 4, 12, 88, 77, 5]
    for index in assign_list:
        active_list_obj.addActiveIndex(index)
    mode = active_list_obj.getMode()
    assert mode == ActiveMode.PARTLY_ACTIVE
    list2 = active_list_obj.get_active_index_list()
    # Can not assume that the list is sorted or that it is
    # in the same order as the order the elements are added
    assign_list.sort()
    list2.sort()
    assert assign_list == list2
    default_value = 10
    size = active_list_obj.getActiveSize(default_value)
    assert size == len(list2)
Beispiel #3
0
 def test_create(self):
     active_list = ActiveList()
     self.assertEqual(active_list.getMode(), ActiveMode.ALL_ACTIVE)
     active_list.addActiveIndex(10)
     self.assertEqual(active_list.getMode(), ActiveMode.PARTLY_ACTIVE)