def check_exception(self, root_path: pathlib.Path, actual: Exception, put: unittest.TestCase): put.assertIsInstance(actual, SuiteFileReferenceError) put.assertEqual(str(self.root_suite_based_at(root_path)), str(actual.suite_file), 'Source file that contains the error') assert_equals_line_sequence( put, single_line_sequence(2, 'does-not_exist.case'), actual.source)
def check_exception(self, root_path: pathlib.Path, actual: Exception, put: unittest.TestCase): put.assertIsInstance(actual, SuiteParseError) put.assertEqual(str(self.root_suite_based_at(root_path)), str(actual.suite_file), 'Source file that contains the error') assert_equals_line_sequence( put, single_line_sequence(1, '"starting but no closing double quote'), actual.source)
def check_exception(self, root_path: pathlib.Path, actual: Exception, put: unittest.TestCase): put.assertIsInstance(actual, SuiteFileReferenceError) put.assertEqual(str(self.root_suite_based_at(root_path)), str(actual.suite_file), 'Source file that contains the error') assert_equals_line_sequence(put, single_line_sequence(2, 'does-not_exist.suite'), actual.source)
def check_exception(self, root_path: pathlib.Path, actual: Exception, put: unittest.TestCase): put.assertIsInstance(actual, SuiteParseError) put.assertEqual(str(self.root_suite_based_at(root_path)), str(actual.suite_file), 'Source file that contains the error') assert_equals_line_sequence(put, single_line_sequence(1, '"starting but no closing double quote'), actual.source)
def assertions_(self, unittest_case: unittest.TestCase, phase_step: PhaseStep, actual_line: line_source.LineSequence, actual_details: FailureDetails): unittest_case.assertIsInstance(phase_step, PhaseStep, 'must be PhaseStep value') self._phase_step.apply_with_message(unittest_case, phase_step.simple, 'phase_step') if self._source_line is not None: assert_equals_line_sequence(unittest_case, self._source_line, actual_line) self._expected_failure_details.apply_without_message( unittest_case, actual_details)
def check_exception(self, root_path: pathlib.Path, actual: Exception, put: unittest.TestCase): put.assertIsInstance(actual, SuiteDoubleInclusion) put.assertEqual(str(Path('local-2.suite')), str(actual.suite_file), 'Source file that contains the error') assert_equals_line_sequence( put, single_line_sequence(3, 'subdir/in-subdir.suite'), actual.source) put.assertEqual( Path('subdir') / 'in-subdir.suite', actual.included_suite_file, 'File that is included twice') put.assertEqual(Path('local-1.suite'), actual.first_referenced_from, 'File that first included the suite file')
def check_exception(self, root_path: pathlib.Path, actual: Exception, put: unittest.TestCase): put.assertIsInstance(actual, SuiteDoubleInclusion) put.assertEqual(str(self.root_suite_based_at(root_path)), str(actual.suite_file), 'Source file that contains the error') assert_equals_line_sequence(put, single_line_sequence(2, 'main.suite'), actual.source) put.assertEqual(self.root_suite_based_at(root_path), actual.included_suite_file, 'File that is included twice') put.assertEqual(None, actual.first_referenced_from, 'File that first included the suite file')
def assertions_(self, unittest_case: unittest.TestCase, phase_step: PhaseStep, actual_line: line_source.LineSequence, actual_details: FailureDetails): unittest_case.assertIsInstance(phase_step, PhaseStep, 'must be PhaseStep value') self._phase_step.apply_with_message(unittest_case, phase_step.simple, 'phase_step') if self._source_line is not None: assert_equals_line_sequence(unittest_case, self._source_line, actual_line) self._expected_failure_details.apply_without_message(unittest_case, actual_details)
def test_instruction_in_default_section_SHOULD_not_be_allowed_when_there_is_no_default_section(self): # ARRANGE # parser = parser_for_sections(['section 1']) source_lines = ['instruction default', '[section 1]', 'instruction 1'] # ACT & ASSERT # with self.assertRaises(FileSourceError) as cm: self._parse_lines(parser, source_lines) # ASSERT # assert_equals_line_sequence(self, line_source.single_line_sequence(1, 'instruction default'), cm.exception.source) self.assertIsNone(cm.exception.maybe_section_name, 'Section name')
def check_exception(self, root_path: pathlib.Path, actual: Exception, put: unittest.TestCase): put.assertIsInstance(actual, SuiteDoubleInclusion) put.assertEqual(str(Path('local-2.suite')), str(actual.suite_file), 'Source file that contains the error') assert_equals_line_sequence(put, single_line_sequence(3, 'subdir/in-subdir.suite'), actual.source) put.assertEqual(Path('subdir') / 'in-subdir.suite', actual.included_suite_file, 'File that is included twice') put.assertEqual(Path('local-1.suite'), actual.first_referenced_from, 'File that first included the suite file')