def test_last(self, index_after_last_element, size, array,
               expected_result):
     array_queue = ArrayDeque(array=array)
     array_queue._index_after_last_element = index_after_last_element
     array_queue._size = size
     actual_result = array_queue.last()
     assert actual_result == expected_result
 def test__get_effective_last_element_index(self, index_after_last_element,
                                            size, initial_length,
                                            expected_result):
     array_queue = ArrayDeque(initial_length=initial_length)
     array_queue._index_after_last_element = index_after_last_element
     array_queue._size = size
     actual_result = array_queue._get_effective_last_element_index()
     assert actual_result == expected_result
 def test_add_first(self, index_after_last_element, size, array, element,
                    expected_result):
     array_queue = ArrayDeque(array=array)
     array_queue._index_after_last_element = index_after_last_element
     array_queue._size = size
     array_queue.add_first(element)
     actual_result = array_queue.to_dict()
     assert actual_result == expected_result
 def test__get_effective_last_element_index_if_array_is_empty_should_rise_exception(
     self,
     index_after_last_element,
     size,
     initial_length,
 ):
     array_queue = ArrayDeque(initial_length=initial_length)
     array_queue._index_after_last_element = index_after_last_element
     array_queue._size = size
     with pytest.raises(EmptyCollection):
         array_queue._get_effective_last_element_index()
 def test__get_index_after_last_element(self, index_after_last_element,
                                        expected_result):
     array_queue = ArrayDeque()
     array_queue._index_after_last_element = index_after_last_element
     actual_result = array_queue._get_index_after_last_element()
     assert actual_result == expected_result
 def test___init__with_default_values(self, expected_result):
     array_deque = ArrayDeque()
     actual_result = array_deque.to_dict()
     assert actual_result == expected_result
 def test___init__passed_empty_array(self, array, expected_result):
     array_deque = ArrayDeque(array=array)
     actual_result = array_deque.to_dict()
     assert actual_result == expected_result
 def test___init__passed_array_is_none(self, initial_length, array,
                                       expected_result):
     array_deque = ArrayDeque(initial_length=initial_length, array=array)
     actual_result = array_deque.to_dict()
     assert actual_result == expected_result