def test_successful_sequence(self):
     phase_contents = SectionContents((
         new_instruction_element(Line(1, '1'),
                                 TestInstruction('First instruction')),
         new_comment_element(Line(2, '2')),
         new_instruction_element(Line(3, '3'),
                                 TestInstruction('Second instruction')),
         new_comment_element(Line(4, '4')),
         new_comment_element(Line(50, '50')),
         new_instruction_element(Line(60, '60'),
                                 TestInstruction('Third instruction')),
         new_instruction_element(Line(70, '70'),
                                 TestInstruction('Fourth instruction')),
         new_comment_element(Line(80, '80')),
     ))
     self._standard_test_with_successful_instruction_executor(
         phase_contents, asrt_failure.is_not_present(), [
             'instruction header for source line number: 1',
             'instruction executor: First instruction',
             'comment header for source line number: 2',
             'instruction header for source line number: 3',
             'instruction executor: Second instruction',
             'comment header for source line number: 4',
             'comment header for source line number: 50',
             'instruction header for source line number: 60',
             'instruction executor: Third instruction',
             'instruction header for source line number: 70',
             'instruction executor: Fourth instruction',
             'comment header for source line number: 80',
         ])
 def test_when_there_are_only_comment_elements_than_the_result_should_be_pass(self):
     phase_contents = SectionContents((new_comment_element(Line(1, '1')),
                                       new_comment_element(Line(2, '2'))))
     self._standard_test_with_successful_instruction_executor(
         phase_contents,
         asrt_failure.is_not_present(),
         ['comment header for source line number: 1',
          'comment header for source line number: 2'])
 def test_when_there_are_only_comment_elements_than_the_result_should_be_pass(self):
     phase_contents = SectionContents((new_comment_element(Line(1, '1')),
                                       new_comment_element(Line(2, '2'))))
     self._standard_test_with_successful_instruction_executor(
         phase_contents,
         asrt_failure.is_not_present(),
         ['comment header for source line number: 1',
          'comment header for source line number: 2'])
 def test_successful_execution_of_single_instruction(self):
     phase_contents = SectionContents(
         (new_instruction_element(Line(1, '1'),
                                  TestInstruction('The instruction')), ))
     self._standard_test_with_successful_instruction_executor(
         phase_contents, asrt_failure.is_not_present(), [
             'instruction header for source line number: 1',
             'instruction executor: The instruction'
         ])
 def test_successful_execution_of_single_instruction(self):
     phase_contents = SectionContents((new_instruction_element(Line(1, '1'),
                                                               TestInstruction('The instruction')),
                                       ))
     self._standard_test_with_successful_instruction_executor(
         phase_contents,
         asrt_failure.is_not_present(),
         ['instruction header for source line number: 1',
          'instruction executor: The instruction'])
    def test_successful_sequence(self):
        phase_contents = SectionContents((new_instruction_element(Line(1, '1'),
                                                                  TestInstruction('First instruction')),
                                          new_comment_element(Line(2, '2')),
                                          new_instruction_element(Line(3, '3'),
                                                                  TestInstruction('Second instruction')),
                                          new_comment_element(Line(4, '4')),
                                          new_comment_element(Line(50, '50')),
                                          new_instruction_element(Line(60, '60'),
                                                                  TestInstruction('Third instruction')),
                                          new_instruction_element(Line(70, '70'),
                                                                  TestInstruction('Fourth instruction')),
                                          new_comment_element(Line(80, '80')),
                                          ))
        self._standard_test_with_successful_instruction_executor(
            phase_contents,
            asrt_failure.is_not_present(),
            ['instruction header for source line number: 1',
             'instruction executor: First instruction',

             'comment header for source line number: 2',

             'instruction header for source line number: 3',
             'instruction executor: Second instruction',

             'comment header for source line number: 4',

             'comment header for source line number: 50',

             'instruction header for source line number: 60',
             'instruction executor: Third instruction',

             'instruction header for source line number: 70',
             'instruction executor: Fourth instruction',

             'comment header for source line number: 80',
             ])
 def test_when_there_are_no_elements_no_executor_should_be_invoked_and_the_result_should_be_pass(
         self):
     phase_contents = SectionContents(())
     self._standard_test_with_successful_instruction_executor(
         phase_contents, asrt_failure.is_not_present(), [])
 def test_when_there_are_no_elements_no_executor_should_be_invoked_and_the_result_should_be_pass(self):
     phase_contents = SectionContents(())
     self._standard_test_with_successful_instruction_executor(
         phase_contents,
         asrt_failure.is_not_present(),
         [])