def test_definition_and_reference_in_definition(self): leaf_name = 'LEAF_SYMBOL_SYMBOL' referrer_name = 'REFERRER_SYMBOL' case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(leaf_name, 'value'), sym_def.define_string( referrer_name, symbol_reference_syntax_for_name(leaf_name)), ])) check_case_and_suite( self, symbol_command_arguments=[case_with_single_def.name], arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(leaf_name, ValueType.STRING, num_refs=1), output.SymbolSummary(referrer_name, ValueType.STRING, num_refs=0), ])), ))
def test_definition_and_reference_in_definition(self): leaf_name = 'LEAF_SYMBOL_SYMBOL' referrer_name = 'REFERRER_SYMBOL' case_with_single_def = File( 'test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(leaf_name, 'value'), sym_def.define_string(referrer_name, symbol_reference_syntax_for_name(leaf_name)), ])) test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.arguments([case_with_single_def.name]), arrangement= Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals(output.list_of([ output.SymbolReport(leaf_name, ValueType.STRING, num_refs=1), output.SymbolReport(referrer_name, ValueType.STRING, num_refs=0), ])), ) )
def test_definition_in_suite_and_case(self): # ARRANGE # symbol_in_suite = 'SUITE_STRING_SYMBOL' symbol_in_case__before_preproc = 'CASE_STRING_SYMBOL__BEFORE_PRE_PROC' symbol_in_case__after_preproc = 'CASE_STRING_SYMBOL' suite_with_preprocessor = File( 'with-preprocessor.suite', lines_content([ section_names.CONFIGURATION.syntax, suite_instructions.set_search_replace_preprocessor( symbol_in_case__before_preproc, symbol_in_case__after_preproc ), phase_names.SETUP.syntax, sym_def.define_string(symbol_in_suite, 'suite-value'), ]) ) case_with_single_def = File( 'test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(symbol_in_case__before_preproc, 'case-value'), ])) # ACT & ASSERT # test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.explicit_suite_and_case(suite_with_preprocessor.name, case_with_single_def.name), arrangement= Arrangement( cwd_contents=DirContents([ suite_with_preprocessor, case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals(output.list_of([ output.SymbolReport(symbol_in_suite, ValueType.STRING, num_refs=0), output.SymbolReport(symbol_in_case__after_preproc, ValueType.STRING, num_refs=0), ])), ) )
def test_definition_in_suite_and_case(self): # ARRANGE # symbol_in_suite = 'SUITE_STRING_SYMBOL' symbol_in_case__before_preproc = 'CASE_STRING_SYMBOL__BEFORE_PRE_PROC' symbol_in_case__after_preproc = 'CASE_STRING_SYMBOL' suite_with_preprocessor = File( 'with-preprocessor.suite', lines_content([ section_names.CONFIGURATION.syntax, suite_instructions.set_search_replace_preprocessor( symbol_in_case__before_preproc, symbol_in_case__after_preproc), phase_names.SETUP.syntax, sym_def.define_string(symbol_in_suite, 'suite-value'), ])) case_with_single_def = File( 'test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(symbol_in_case__before_preproc, 'case-value'), ])) # ACT & ASSERT # test_with_files_in_tmp_dir.check( self, command_line_arguments=symbol_args.explicit_suite_and_case( suite_with_preprocessor.name, case_with_single_def.name), arrangement=Arrangement( cwd_contents=DirContents([ suite_with_preprocessor, case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(symbol_in_suite, ValueType.STRING, num_refs=0), output.SymbolSummary(symbol_in_case__after_preproc, ValueType.STRING, num_refs=0), ])), ))
def test_multiple_definition(self): setup_symbol_name = 'SETUP_SYMBOL' before_assert_symbol_name = 'BEFORE_ASSERT_SYMBOL' assert_symbol_name = 'ASSERT_SYMBOL' cleanup_symbol_name = 'CLEANUP_SYMBOL' case_with_one_def_per_phase = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(setup_symbol_name, setup_symbol_name + 'value'), phase_names.BEFORE_ASSERT.syntax, sym_def.define_string(before_assert_symbol_name, before_assert_symbol_name + 'value'), phase_names.ASSERT.syntax, sym_def.define_string(assert_symbol_name, assert_symbol_name + 'value'), phase_names.CLEANUP.syntax, sym_def.define_string(cleanup_symbol_name, cleanup_symbol_name + 'value'), ])) check_case_and_suite( self, symbol_command_arguments=[case_with_one_def_per_phase.name], arrangement=Arrangement( cwd_contents=DirContents([ case_with_one_def_per_phase, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(setup_symbol_name, ValueType.STRING, num_refs=0), output.SymbolSummary(before_assert_symbol_name, ValueType.STRING, num_refs=0), output.SymbolSummary(assert_symbol_name, ValueType.STRING, num_refs=0), output.SymbolSummary(cleanup_symbol_name, ValueType.STRING, num_refs=0), ])), ))
def test_symbol_without_references(self): name_of_existing_symbol = 'STRING_SYMBOL' case_with_single_def = File( 'test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), ])) expected_first_line = output.summary_of_single( output.SymbolSummary(name_of_existing_symbol, ValueType.STRING, num_refs=0)) check_case_and_suite( self, symbol_command_arguments=symbol_args.individual__definition( case_with_single_def.name, name_of_existing_symbol, ), arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt_str.first_line(asrt.equals(expected_first_line))))
def test(self): name_of_existing_symbol = 'STRING_SYMBOL' not_the_name_of_an_existing_symbol = 'NON_EXISTING_SYMBOL' case_with_single_def = File('test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), ])) test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.individual__definition( case_with_single_def.name, not_the_name_of_an_existing_symbol, ), arrangement= Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.is_result_for_empty_stdout( exit_values.EXECUTION__HARD_ERROR.exit_code ) )
def test(self): name_of_existing_symbol = 'STRING_SYMBOL' not_the_name_of_an_existing_symbol = 'NON_EXISTING_SYMBOL' case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), ])) check_case_and_suite( self, symbol_command_arguments=symbol_args.individual__references( case_with_single_def.name, not_the_name_of_an_existing_symbol, ), arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.is_result_for_empty_stdout( exit_values.EXECUTION__HARD_ERROR.exit_code))
def test_single_definition_with_reference_to_builtin_symbol(self): builtin_symbol = StringSymbolContext.of_constant( 'BUILTIN_STRING_SYMBOL', 'builtin string symbol value') user_defined_symbol_name = 'STRING_SYMBOL' case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string( user_defined_symbol_name, symbol_reference_syntax_for_name(builtin_symbol.name)), ])) check_case_and_suite( self, symbol_command_arguments=[case_with_single_def.name], arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config( builtin_symbols=[ sym_def.builtin_symbol(builtin_symbol), ]), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(user_defined_symbol_name, ValueType.STRING, num_refs=0), ])), ))
def test_single_reference_in_act_phase(self): name_of_existing_symbol = 'STRING_SYMBOL' reference_source = sym_def.reference_to(name_of_existing_symbol, ValueType.STRING) case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), phase_names.ACT.syntax, reference_source, ])) expected_reference_output = output.Reference(phase_identifier.ACT, None, [ reference_source, ]) check_case_and_suite( self, symbol_command_arguments=symbol_args.individual__references( case_with_single_def.name, name_of_existing_symbol, ), arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( lines_content(expected_reference_output.output_lines()))))
def test_single_definition_with_single_reference_in_act_phase__with_actor_set_in_conf( self): symbol_name = 'STRING_SYMBOL' case_with_single_def = File( 'test.xly', lines_content([ phase_names.CONFIGURATION.syntax, sym_def.SET_ACTOR_THAT_PARSES_REFERENCES_INSTRUCTION_NAME, phase_names.SETUP.syntax, sym_def.define_string(symbol_name, 'value'), phase_names.ACT.syntax, sym_def.reference_to(symbol_name, ValueType.STRING), ])) check_case_and_suite( self, symbol_command_arguments=[case_with_single_def.name], arrangement=Arrangement( main_program_config=sym_def.main_program_config( ActorThatRaisesParseException()), cwd_contents=DirContents([ case_with_single_def, ]), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(symbol_name, ValueType.STRING, num_refs=1), ])), ))
def test(self): name_of_existing_symbol = 'STRING_SYMBOL' case_with_single_def = File('test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), ])) expected_first_line = output.list_of([output.SymbolReport(name_of_existing_symbol, ValueType.STRING, num_refs=0)]).rstrip() test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.individual__definition( case_with_single_def.name, name_of_existing_symbol, ), arrangement= Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt_str.first_line(asrt.equals(expected_first_line))) )
def test_single_definition_in_default_suite_file(self): symbol_name = 'STRING_SYMBOL' suite_with_single_def = File( DEFAULT_SUITE_FILE, lines_content([ phase_names.SETUP.syntax, sym_def.define_string(symbol_name, 'value'), ])) dir_arg = Dir('a-dir', [suite_with_single_def]) test_with_files_in_tmp_dir.check( self, command_line_arguments=symbol_args.arguments__suite([dir_arg.name ]), arrangement=Arrangement( cwd_contents=DirContents([ dir_arg, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(symbol_name, ValueType.STRING, num_refs=0), ])), ))
def test_multiple_definition(self): setup_symbol_name = 'SETUP_SYMBOL' before_assert_symbol_name = 'BEFORE_ASSERT_SYMBOL' assert_symbol_name = 'ASSERT_SYMBOL' cleanup_symbol_name = 'CLEANUP_SYMBOL' case_with_one_def_per_phase = File( 'test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(setup_symbol_name, setup_symbol_name + 'value'), phase_names.BEFORE_ASSERT.syntax, sym_def.define_string(before_assert_symbol_name, before_assert_symbol_name + 'value'), phase_names.ASSERT.syntax, sym_def.define_string(assert_symbol_name, assert_symbol_name + 'value'), phase_names.CLEANUP.syntax, sym_def.define_string(cleanup_symbol_name, cleanup_symbol_name + 'value'), ])) test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.arguments([case_with_one_def_per_phase.name]), arrangement= Arrangement( cwd_contents=DirContents([ case_with_one_def_per_phase, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals(output.list_of([ output.SymbolReport(setup_symbol_name, ValueType.STRING, num_refs=0), output.SymbolReport(before_assert_symbol_name, ValueType.STRING, num_refs=0), output.SymbolReport(assert_symbol_name, ValueType.STRING, num_refs=0), output.SymbolReport(cleanup_symbol_name, ValueType.STRING, num_refs=0), ])), ) )
def test_definition_in_suite_and_case(self): symbol_in_suite_name = 'SUITE_SYMBOL' symbol_in_case_name = 'CASE_SYMBOL' suite_with_single_def = lines_content([ section_names.CASE__SETUP.syntax, sym_def.define_string(symbol_in_suite_name, 'value'), ]) case_with_single_def = File( 'test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(symbol_in_case_name, 'value'), ])) for suite_case in suite_cases('single-definition.suite'): with self.subTest(suite_case.name): test_with_files_in_tmp_dir.check( self, command_line_arguments=symbol_args.arguments( suite_case.value.suite_arguments + [case_with_single_def.name]), arrangement=Arrangement( cwd_contents=DirContents([ suite_case.value.suite_file(suite_with_single_def), case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(symbol_in_suite_name, ValueType.STRING, num_refs=0), output.SymbolSummary(symbol_in_case_name, ValueType.STRING, num_refs=0), ])), ))
def test_definition_in_suite_and_case(self): symbol_in_suite_name = 'SUITE_SYMBOL' symbol_in_case_name = 'CASE_SYMBOL' suite_with_single_def = lines_content([ section_names.CASE__SETUP.syntax, sym_def.define_string(symbol_in_suite_name, 'value'), ]) case_with_single_def = File('test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(symbol_in_case_name, 'value'), ])) for suite_case in suite_cases('single-definition.suite'): with self.subTest(suite_case.name): test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.arguments(suite_case.value.suite_arguments + [case_with_single_def.name]), arrangement= Arrangement( cwd_contents=DirContents([ suite_case.value.suite_file(suite_with_single_def), case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals(output.list_of([ output.SymbolReport(symbol_in_suite_name, ValueType.STRING, num_refs=0), output.SymbolReport(symbol_in_case_name, ValueType.STRING, num_refs=0), ])), ) )
def test_single_reference_to_builtin_symbol(self): name_of_user_defined_symbol = 'USER_DEFINED_SYMBOL' builtin_symbol = StringSymbolContext.of_constant( 'BUILTIN_SYMBOL', 'builtin string symbol value') definition_source = sym_def.define_string( name_of_user_defined_symbol, symbol_reference_syntax_for_name(builtin_symbol.name)) case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, definition_source, ])) expected_reference_output = output.Reference( phase_identifier.SETUP, output.LineInFilePosition(case_with_single_def.name, 2), [ definition_source, ]) check_case_and_suite( self, symbol_command_arguments=symbol_args.individual__references( case_with_single_def.name, builtin_symbol.name, ), arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config( builtin_symbols=[ sym_def.builtin_symbol(builtin_symbol), ]), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( lines_content(expected_reference_output.output_lines()))))
def test_single_reference_in_act_phase(self): name_of_existing_symbol = 'STRING_SYMBOL' reference_source = sym_def.reference_to(name_of_existing_symbol, ValueType.STRING) case_with_single_def = File('test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), phase_names.ACT.syntax, reference_source, ])) expected_reference_output = output.Reference( phase_identifier.ACT, None, [ reference_source, ] ) test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.individual__references( case_with_single_def.name, name_of_existing_symbol, ), arrangement= Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals(lines_content(expected_reference_output.output_lines())) ) )
def test_single_definition(self): symbol_name__before_preproc = 'STRING_SYMBOL__BEFORE_PRE_PROC' symbol_name__after_preproc = 'STRING_SYMBOL' py_pgm_that_replaces_symbol_name = File( 'replace.py', preprocessor_utils.SEARCH_REPLACE_PREPROCESSOR__PY_SRC) case_with_single_def = File( 'test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(symbol_name__before_preproc, 'value'), ])) test_with_files_in_tmp_dir.check( self, command_line_arguments=symbol_args. py_search_replace_preprocessing_and_case( py_pgm_that_replaces_symbol_name.name, symbol_name__before_preproc, symbol_name__after_preproc, case_with_single_def.name), arrangement=Arrangement( cwd_contents=DirContents([ py_pgm_that_replaces_symbol_name, case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(symbol_name__after_preproc, ValueType.STRING, num_refs=0), ])), ))
def test_single_definition(self): symbol_name__before_preproc = 'STRING_SYMBOL__BEFORE_PRE_PROC' symbol_name__after_preproc = 'STRING_SYMBOL' py_pgm_that_replaces_symbol_name = File( 'replace.py', preprocessor_utils.SEARCH_REPLACE_PREPROCESSOR__PY_SRC ) case_with_single_def = File('test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(symbol_name__before_preproc, 'value'), ])) test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.py_search_replace_preprocessing_and_case(py_pgm_that_replaces_symbol_name.name, symbol_name__before_preproc, symbol_name__after_preproc, case_with_single_def.name), arrangement= Arrangement( cwd_contents=DirContents([ py_pgm_that_replaces_symbol_name, case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals(output.list_of([ output.SymbolReport(symbol_name__after_preproc, ValueType.STRING, num_refs=0), ])), ) )
def test_symbol_with_reference_to_builtin_symbol(self): existing_builtin_symbol = StringSymbolContext.of_constant( 'BUILTIN_STRING_SYMBOL', 'the builtin symbol value') name_of_existing_user_defined_symbol = 'USER_DEFINED_STRING_SYMBOL' case_with_single_def = File( 'test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string( name_of_existing_user_defined_symbol, symbol_reference_syntax_for_name( existing_builtin_symbol.name)), ])) expected_first_line = output.summary_of_single( output.SymbolSummary(name_of_existing_user_defined_symbol, ValueType.STRING, num_refs=0)) check_case_and_suite( self, symbol_command_arguments=symbol_args.individual__definition( case_with_single_def.name, name_of_existing_user_defined_symbol, ), arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config( builtin_symbols=[ sym_def.builtin_symbol(existing_builtin_symbol) ], ), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt_str.first_line(asrt.equals(expected_first_line))))
def test_references_SHOULD_be_listed_phase_order(self): name_of_existing_symbol = 'STRING_SYMBOL' reference_source = sym_def.reference_to(name_of_existing_symbol, ValueType.STRING) case_with_references = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), phase_names.CLEANUP.syntax, reference_source, phase_names.ASSERT.syntax, reference_source, phase_names.BEFORE_ASSERT.syntax, reference_source, phase_names.ACT.syntax, reference_source, phase_names.SETUP.syntax, reference_source, ])) expected_reference_outputs = [ output.Reference( phase_identifier.SETUP, output.LineInFilePosition(case_with_references.name, 12), [reference_source]), output.Reference(phase_identifier.ACT, None, [reference_source]), output.Reference( phase_identifier.BEFORE_ASSERT, output.LineInFilePosition(case_with_references.name, 8), [reference_source]), output.Reference( phase_identifier.ASSERT, output.LineInFilePosition(case_with_references.name, 6), [reference_source]), output.Reference( phase_identifier.CLEANUP, output.LineInFilePosition(case_with_references.name, 4), [reference_source]), ] expected_output_lines = list( itertools.chain.from_iterable( intersperse_list(['', ''], list( map(output.Reference.output_lines, expected_reference_outputs))))) check_case_and_suite( self, symbol_command_arguments=symbol_args.individual__references( case_with_references.name, name_of_existing_symbol, ), arrangement=Arrangement( cwd_contents=DirContents([ case_with_references, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals(lines_content(expected_output_lines))))
def test_references_SHOULD_be_listed_phase_order(self): name_of_existing_symbol = 'STRING_SYMBOL' reference_source = sym_def.reference_to(name_of_existing_symbol, ValueType.STRING) case_with_references = File('test.case', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), phase_names.CLEANUP.syntax, reference_source, phase_names.ASSERT.syntax, reference_source, phase_names.BEFORE_ASSERT.syntax, reference_source, phase_names.ACT.syntax, reference_source, phase_names.SETUP.syntax, reference_source, ])) expected_reference_outputs = [ output.Reference( phase_identifier.SETUP, output.LineInFilePosition(case_with_references.name, 12), [reference_source] ), output.Reference( phase_identifier.ACT, None, [reference_source] ), output.Reference( phase_identifier.BEFORE_ASSERT, output.LineInFilePosition(case_with_references.name, 8), [reference_source] ), output.Reference( phase_identifier.ASSERT, output.LineInFilePosition(case_with_references.name, 6), [reference_source] ), output.Reference( phase_identifier.CLEANUP, output.LineInFilePosition(case_with_references.name, 4), [reference_source] ), ] expected_output_lines = list(itertools.chain.from_iterable( intersperse_list([''], list(map(output.Reference.output_lines, expected_reference_outputs))) ) ) test_with_files_in_tmp_dir.check( self, command_line_arguments= symbol_args.individual__references( case_with_references.name, name_of_existing_symbol, ), arrangement= Arrangement( cwd_contents=DirContents([ case_with_references, ]), main_program_config=sym_def.main_program_config(), ), expectation= asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals(lines_content(expected_output_lines))) )