class IStaticStateIteratorTest(TestCase): def setUp(self): self._default = IStaticStateIterator( solution_class=TrajectorySolutionData, element_type=IStepState, num_states=3 ) def test_is_iterable(self): is_iterable(self._default, IStepState, 3) def test_on_proceed_does_not_change_size(self): _old_len = len(self._default) self._default.proceed() self.assertIs(len(self._default), _old_len) def test_current_accessor(self): has_current_accessor(self._default) def test_previous_accessor(self): has_previous_accessor(self._default) def test_next_accessor(self): has_next_accessor(self._default) def test_first_and_last_accessor(self): has_first_and_last_accessor(self._default) _no_states = IStateIterator(solution_class=TrajectorySolutionData, element_type=IStepState) assert_is_none(_no_states.first) assert_is_none(_no_states.first_index) assert_is_none(_no_states.last) assert_is_none(_no_states.last_index) def test_on_finalize_collect_solutions_and_finalize(self): on_finalize_collect_solutions_and_finalize(self._default)
def setUp(self): self._default = IStaticStateIterator( solution_class=TrajectorySolutionData, element_type=IStepState, num_states=3 )