def _check_defaults(self, default_environ: Optional[Mapping[str, str]]):
        recording_media = _empty_recording_media()
        expected_recordings = [
            # setup #
            RecordingEntry.from_settings(PhaseEnum.SETUP, None,
                                         default_environ),
            # act #
            RecordingEntry.from_settings(PhaseEnum.ACT, None, default_environ),
        ]

        helper = RecordingsHelper(recording_media)
        test_case = partial_test_case_with_instructions([
            setup_phase_instruction_that(
                main_initial_action=helper.action_for_recordings_for(
                    PhaseEnum.SETUP, None), ),
        ], )
        actor_that_records_env_vars_of_act_exe_input = ActorThatRunsConstantActions(
            execute_initial_action=helper.
            actor_action_for_recording_environ_of_act_exe_input, )
        # ACT #
        test__va(
            self,
            test_case,
            Arrangement(
                actor=actor_that_records_env_vars_of_act_exe_input,
                environ=default_environ,
            ),
            result_is_pass(),
        )
        self.assertEqual(expected_recordings, recording_media, 'recordings')
예제 #2
0
    def test_one_symbol_is_predefined(self):
        predefined_symbol = StringSymbolContext.of_constant(
            'predefined symbol name',
            'predefined string constant symbol value')

        expected_predefined_symbols = predefined_symbol.symbol_table
        all_predefined_symbols = frozenset((predefined_symbol.name, ))

        expected_phase_2_step_2_names_set = {
            PhaseEnum.SETUP:
            psr.same_value_for_all_steps(step.ALL_SETUP_WITH_ENV_ARG,
                                         all_predefined_symbols),
            PhaseEnum.ACT:
            psr.same_value_for_all_steps(step.ALL_ACT_WITH_ENV_ARG,
                                         all_predefined_symbols),
            PhaseEnum.BEFORE_ASSERT:
            psr.same_value_for_all_steps(step.ALL_BEFORE_ASSERT_WITH_ENV_ARG,
                                         all_predefined_symbols),
            PhaseEnum.ASSERT:
            psr.same_value_for_all_steps(step.ALL_ASSERT_WITH_ENV_ARG,
                                         all_predefined_symbols),
            PhaseEnum.CLEANUP:
            psr.same_value_for_all_steps(step.ALL_CLEANUP_WITH_ENV_ARG,
                                         all_predefined_symbols),
        }
        actual_phase_2_step_2_names_set = psr.new_phase_enum_2_empty_dict()

        def recorder_for(phase_step: SimplePhaseStep):
            return psr.StepRecordingAction(
                phase_step, actual_phase_2_step_2_names_set,
                get_symbols_name_set_from_instruction_environment)

        test_case = partial_test_case_with_instructions(
            [
                psr.setup_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            psr.act_phase_instructions_that_does_nothing(),
            [
                psr.
                before_assert_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            [
                psr.assert_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            [
                psr.cleanup_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
        )
        test__va(
            self, test_case,
            Arrangement(psr.actor_that_records_a_value_per_step(
                recorder_for, recorder_for_parse_step=psr.no_recording),
                        predefined_symbols=expected_predefined_symbols),
            asrt.anything_goes())
        _check_result(self, expected_phase_2_step_2_names_set,
                      actual_phase_2_step_2_names_set)
예제 #3
0
    def test(self):
        hds_with_different_sub_dirs = fake_hds()

        expected_phase_2_step_2_names_set = {
            PhaseEnum.SETUP:
            psr.same_value_for_all_steps(step.ALL_SETUP_WITH_ENV_ARG,
                                         hds_with_different_sub_dirs),
            PhaseEnum.ACT:
            psr.same_value_for_all_steps(step.ALL_ACT_WITH_ENV_ARG,
                                         hds_with_different_sub_dirs),
            PhaseEnum.BEFORE_ASSERT:
            psr.same_value_for_all_steps(step.ALL_BEFORE_ASSERT_WITH_ENV_ARG,
                                         hds_with_different_sub_dirs),
            PhaseEnum.ASSERT:
            psr.same_value_for_all_steps(step.ALL_ASSERT_WITH_ENV_ARG,
                                         hds_with_different_sub_dirs),
            PhaseEnum.CLEANUP:
            psr.same_value_for_all_steps(step.ALL_CLEANUP_WITH_ENV_ARG,
                                         hds_with_different_sub_dirs),
        }
        actual_phase_2_step_2_names_set = psr.new_phase_enum_2_empty_dict()

        def recorder_for(phase_step: SimplePhaseStep):
            return psr.StepRecordingAction(
                phase_step, actual_phase_2_step_2_names_set,
                get_hds_from_instruction_environment)

        test_case = partial_test_case_with_instructions(
            [
                psr.setup_phase_instruction_that_records_a_value_per_step(
                    recorder_for),
            ],
            psr.act_phase_instructions_that_does_nothing(),
            [
                psr.
                before_assert_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            [
                psr.assert_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            [
                psr.cleanup_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
        )
        test__va(
            self, test_case,
            Arrangement(psr.actor_that_records_a_value_per_step(
                recorder_for, recorder_for_parse_step=psr.no_recording),
                        hds=hds_with_different_sub_dirs), asrt.anything_goes())
        self._check_result(expected_phase_2_step_2_names_set,
                           actual_phase_2_step_2_names_set)
예제 #4
0
    def test_one_symbol_is_predefined(self):
        predefined_symbol = NameAndValue('predefined symbol name',
                                         'predefined string constant symbol value')

        expected_predefined_symbols = SymbolTable({
            predefined_symbol.name: symbol_utils.container(string_resolvers.str_constant(predefined_symbol.value))
        })
        all_predefined_symbols = frozenset((predefined_symbol.name,))

        expected_phase_2_step_2_names_set = {
            PhaseEnum.SETUP: psr.same_value_for_all_steps(step.ALL_SETUP_WITH_ENV_ARG, all_predefined_symbols),
            PhaseEnum.ACT: psr.same_value_for_all_steps(step.ALL_ACT_WITH_ENV_ARG, all_predefined_symbols),
            PhaseEnum.BEFORE_ASSERT: psr.same_value_for_all_steps(step.ALL_BEFORE_ASSERT_WITH_ENV_ARG,
                                                                  all_predefined_symbols),
            PhaseEnum.ASSERT: psr.same_value_for_all_steps(step.ALL_ASSERT_WITH_ENV_ARG, all_predefined_symbols),
            PhaseEnum.CLEANUP: psr.same_value_for_all_steps(step.ALL_CLEANUP_WITH_ENV_ARG, all_predefined_symbols),
        }
        actual_phase_2_step_2_names_set = psr.new_phase_enum_2_empty_dict()

        def recorder_for(phase_step: SimplePhaseStep):
            return psr.StepRecordingAction(phase_step,
                                           actual_phase_2_step_2_names_set,
                                           get_symbols_name_set_from_instruction_environment)

        test_case = partial_test_case_with_instructions(
            [
                psr.setup_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            psr.act_phase_instructions_that_does_nothing(),
            [
                psr.before_assert_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            [
                psr.assert_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            [
                psr.cleanup_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
        )
        test__va(
            self,
            test_case,
            Arrangement(psr.actor_that_records_a_value_per_step(recorder_for,
                                                                recorder_for_parse_step=psr.no_recording),
                        predefined_symbols=expected_predefined_symbols),
            asrt.anything_goes())
        _check_result(self,
                      expected_phase_2_step_2_names_set,
                      actual_phase_2_step_2_names_set)
예제 #5
0
    def test_set_environment_variable_in_phase_cleanup(self):
        recorder = _RecorderOfExistenceOfGlobalEnvVar(_unique_variable_name())

        test_case = partial_test_case_with_instructions(
            [],
            _act_phase_instructions_that_are_not_relevant_to_this_test(),
            [],
            [],
            [cleanup_phase_instruction_that(
                main_initial_action=Sequence([SetEnvironmentVariableViaInstructionArguments(recorder.variable_name),
                                              recorder.for_step(step.CLEANUP__MAIN)]))],
        )
        test__va(
            self,
            test_case,
            Arrangement(actor=dummy_actor()),
            AssertPhasesWhereTheEnvironmentVariableExistsInTheGlobalEnvironmentIsEmpty(recorder.recorded_steps))
    def runTest(self):
        default_environ = None
        modified_environ = {'modified_var': 'val of modified var'}

        recording_media = _empty_recording_media()
        expected_recordings = [
            # setup #
            RecordingEntry.from_settings(PhaseEnum.SETUP,
                                         PosInPhase.BEFORE_MODIFY,
                                         default_environ),
            RecordingEntry.from_settings(PhaseEnum.SETUP,
                                         PosInPhase.AFTER_MODIFY,
                                         modified_environ),
            # act #
            RecordingEntry.from_settings(PhaseEnum.ACT, None,
                                         modified_environ),
        ]

        helper = RecordingsHelper(recording_media)
        test_case = partial_test_case_with_instructions([
            setup_phase_instruction_that(
                main_initial_action=helper.action_for_recordings_for(
                    PhaseEnum.SETUP, PosInPhase.BEFORE_MODIFY), ),
            setup_phase_instruction_that(
                main_initial_action=ActionThatSetsSettings(
                    dict(modified_environ)).initial_action, ),
            setup_phase_instruction_that(
                main_initial_action=helper.action_for_recordings_for(
                    PhaseEnum.SETUP, PosInPhase.AFTER_MODIFY), ),
        ], )
        actor_that_records_env_vars_of_act_exe_input = ActorThatRunsConstantActions(
            execute_initial_action=helper.
            actor_action_for_recording_environ_of_act_exe_input, )
        # ACT #
        test__va(
            self,
            test_case,
            Arrangement(
                actor=actor_that_records_env_vars_of_act_exe_input,
                environ=default_environ,
            ),
            result_is_pass(),
        )
        self.assertEqual(expected_recordings, recording_media, 'recordings')
예제 #7
0
    def test(self):
        hds_with_different_sub_dirs = fake_hds()

        expected_phase_2_step_2_names_set = {
            PhaseEnum.SETUP: psr.same_value_for_all_steps(step.ALL_SETUP_WITH_ENV_ARG, hds_with_different_sub_dirs),
            PhaseEnum.ACT: psr.same_value_for_all_steps(step.ALL_ACT_WITH_ENV_ARG, hds_with_different_sub_dirs),
            PhaseEnum.BEFORE_ASSERT: psr.same_value_for_all_steps(step.ALL_BEFORE_ASSERT_WITH_ENV_ARG,
                                                                  hds_with_different_sub_dirs),
            PhaseEnum.ASSERT: psr.same_value_for_all_steps(step.ALL_ASSERT_WITH_ENV_ARG, hds_with_different_sub_dirs),
            PhaseEnum.CLEANUP: psr.same_value_for_all_steps(step.ALL_CLEANUP_WITH_ENV_ARG, hds_with_different_sub_dirs),
        }
        actual_phase_2_step_2_names_set = psr.new_phase_enum_2_empty_dict()

        def recorder_for(phase_step: SimplePhaseStep):
            return psr.StepRecordingAction(phase_step,
                                           actual_phase_2_step_2_names_set,
                                           get_hds_from_instruction_environment)

        test_case = partial_test_case_with_instructions(
            [
                psr.setup_phase_instruction_that_records_a_value_per_step(recorder_for),
            ],
            psr.act_phase_instructions_that_does_nothing(),
            [
                psr.before_assert_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            [
                psr.assert_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            [
                psr.cleanup_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
        )
        test__va(
            self,
            test_case,
            Arrangement(psr.actor_that_records_a_value_per_step(recorder_for,
                                                                recorder_for_parse_step=psr.no_recording),
                        hds=hds_with_different_sub_dirs),
            asrt.anything_goes())
        self._check_result(expected_phase_2_step_2_names_set,
                           actual_phase_2_step_2_names_set)
예제 #8
0
    def test_set_environment_variable_in_phase_setup(self):
        recorder = _RecorderOfExistenceOfGlobalEnvVar(_unique_variable_name())

        test_case = partial_test_case_with_instructions(
            [setup_phase_instruction_that(
                main_initial_action=Sequence([SetEnvironmentVariableViaInstructionArguments(recorder.variable_name),
                                              recorder.for_step(step.SETUP__MAIN)]),
                validate_post_setup_initial_action=recorder.for_step(step.SETUP__VALIDATE_POST_SETUP))],
            _act_phase_instructions_that_are_not_relevant_to_this_test(),
            [before_assert_phase_instruction_that(
                validate_post_setup_initial_action=recorder.for_step(step.BEFORE_ASSERT__VALIDATE_POST_SETUP),
                main_initial_action=recorder.for_step(step.BEFORE_ASSERT__MAIN))],
            [assert_phase_instruction_that(
                validate_post_setup_initial_action=recorder.for_step(step.ASSERT__VALIDATE_POST_SETUP),
                main_initial_action=recorder.for_step(step.ASSERT__MAIN))],
            [cleanup_phase_instruction_that(
                main_initial_action=recorder.for_step(step.CLEANUP__MAIN))],
        )
        test__va(
            self,
            test_case,
            Arrangement(
                actor=_actor_that_records_existence_of_var_in_global_env(recorder)),
            AssertPhasesWhereTheEnvironmentVariableExistsInTheGlobalEnvironmentIsEmpty(recorder.recorded_steps))
예제 #9
0
    def test_one_symbol_is_defined_in_the_setup_phase(self):
        symbol = NameAndValue('symbol name',
                              'symbol value (not used in test)')
        all_defined_symbols = frozenset((symbol.name,))
        symbol_definition = data_symbol_utils.string_symbol_definition(symbol.name, symbol.value)
        symbol_usages_of_instruction_that_defines_symbol = [symbol_definition]

        expected_phase_2_step_2_names_set = {
            PhaseEnum.SETUP: {
                step.SETUP__VALIDATE_PRE_SDS.step: all_defined_symbols,
                step.SETUP__MAIN.step: set(),
                step.SETUP__VALIDATE_POST_SETUP.step: all_defined_symbols,
            },
            PhaseEnum.ACT: {
                step.ACT__VALIDATE_PRE_SDS.step: all_defined_symbols,
                step.ACT__VALIDATE_POST_SETUP.step: all_defined_symbols,
                step.ACT__EXECUTE.step: all_defined_symbols,
                step.ACT__PREPARE.step: all_defined_symbols,
            },
            PhaseEnum.BEFORE_ASSERT: psr.same_value_for_all_steps(step.ALL_BEFORE_ASSERT_WITH_ENV_ARG,
                                                                  all_defined_symbols),
            PhaseEnum.ASSERT: psr.same_value_for_all_steps(step.ALL_ASSERT_WITH_ENV_ARG, all_defined_symbols),
            PhaseEnum.CLEANUP: psr.same_value_for_all_steps(step.ALL_CLEANUP_WITH_ENV_ARG, all_defined_symbols),
        }
        actual_phase_2_step_2_names_set = psr.new_phase_enum_2_empty_dict()

        def recorder_for(phase_step: SimplePhaseStep):
            return psr.StepRecordingAction(phase_step,
                                           actual_phase_2_step_2_names_set,
                                           get_symbols_name_set_from_instruction_environment)

        test_case = partial_test_case_with_instructions(
            [
                setup_phase_instruction_that(
                    symbol_usages=do_return(symbol_usages_of_instruction_that_defines_symbol),
                    validate_pre_sds_initial_action=recorder_for(step.SETUP__VALIDATE_PRE_SDS),
                    main_initial_action=Sequence([
                        recorder_for(step.SETUP__MAIN),
                        _ActionThatSetsSymbolInSymbolTable(symbol_definition),
                    ]),
                    validate_post_setup_initial_action=recorder_for(step.SETUP__VALIDATE_POST_SETUP),
                )
            ],
            psr.act_phase_instructions_that_does_nothing(),
            [
                psr.before_assert_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            [
                psr.assert_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            [
                psr.cleanup_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
        )
        test__va(
            self,
            test_case,
            Arrangement(psr.actor_that_records_a_value_per_step(recorder_for,
                                                                recorder_for_parse_step=psr.no_recording)),
            asrt.anything_goes())
        _check_result(self,
                      expected_phase_2_step_2_names_set,
                      actual_phase_2_step_2_names_set)
예제 #10
0
    def test_one_symbol_is_predefined_and_one_symbol_is_defined_in_the_setup_phase(self):
        predefined_symbol = NameAndValue('predefined symbol',
                                         'predefined string constant symbol value')
        defined_symbol = NameAndValue('defined symbol',
                                      'value of symbol defined in the setup phase (not used in this test)')
        predefined_symbols_table = SymbolTable({
            predefined_symbol.name: symbol_utils.container(string_resolvers.str_constant(predefined_symbol.value))
        })
        predefined_symbols = frozenset((predefined_symbol.name,))
        predefined_and_defined_symbols = frozenset((predefined_symbol.name, defined_symbol.name))

        symbol_definition = data_symbol_utils.string_symbol_definition(defined_symbol.name, defined_symbol.value)

        symbol_usages_of_instruction_that_defines_symbol = [symbol_definition]

        expected_phase_2_step_2_names_set = {
            PhaseEnum.SETUP: {
                step.SETUP__VALIDATE_PRE_SDS.step: predefined_and_defined_symbols,
                step.SETUP__MAIN.step: predefined_symbols,
                step.SETUP__VALIDATE_POST_SETUP.step: predefined_and_defined_symbols,
            },
            PhaseEnum.ACT: {
                step.ACT__VALIDATE_PRE_SDS.step: predefined_and_defined_symbols,
                step.ACT__VALIDATE_POST_SETUP.step: predefined_and_defined_symbols,
                step.ACT__PREPARE.step: predefined_and_defined_symbols,
                step.ACT__EXECUTE.step: predefined_and_defined_symbols,
            },
            PhaseEnum.BEFORE_ASSERT: {
                step.BEFORE_ASSERT__VALIDATE_PRE_SDS.step: predefined_and_defined_symbols,
                step.BEFORE_ASSERT__VALIDATE_POST_SETUP.step: predefined_and_defined_symbols,
                step.BEFORE_ASSERT__MAIN.step: predefined_and_defined_symbols,

            },
            PhaseEnum.ASSERT: {
                step.ASSERT__VALIDATE_PRE_SDS.step: predefined_and_defined_symbols,
                step.ASSERT__VALIDATE_POST_SETUP.step: predefined_and_defined_symbols,
                step.ASSERT__MAIN.step: predefined_and_defined_symbols,
            },
            PhaseEnum.CLEANUP: {
                step.CLEANUP__VALIDATE_PRE_SDS.step: predefined_and_defined_symbols,
                step.CLEANUP__MAIN.step: predefined_and_defined_symbols,
            },
        }
        actual_phase_2_step_2_names_set = psr.new_phase_enum_2_empty_dict()

        def recorder_for(phase_step: SimplePhaseStep):
            return psr.StepRecordingAction(phase_step,
                                           actual_phase_2_step_2_names_set,
                                           get_symbols_name_set_from_instruction_environment)

        test_case = partial_test_case_with_instructions(
            [
                setup_phase_instruction_that(
                    symbol_usages=do_return(symbol_usages_of_instruction_that_defines_symbol),
                    validate_pre_sds_initial_action=recorder_for(step.SETUP__VALIDATE_PRE_SDS),
                    main_initial_action=Sequence([
                        recorder_for(step.SETUP__MAIN),
                        _ActionThatSetsSymbolInSymbolTable(symbol_definition),
                    ]),
                    validate_post_setup_initial_action=recorder_for(step.SETUP__VALIDATE_POST_SETUP),
                )
            ],
            psr.act_phase_instructions_that_does_nothing(),
            [
                psr.before_assert_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            [
                psr.assert_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
            [
                psr.cleanup_phase_instruction_that_records_a_value_per_step(recorder_for)
            ],
        )
        test__va(
            self,
            test_case,
            Arrangement(
                actor=psr.actor_that_records_a_value_per_step(recorder_for,
                                                              recorder_for_parse_step=psr.no_recording),
                predefined_symbols=predefined_symbols_table),
            asrt.anything_goes())
        _check_result(self,
                      expected_phase_2_step_2_names_set,
                      actual_phase_2_step_2_names_set)
예제 #11
0
    def test_one_symbol_is_defined_in_the_setup_phase(self):
        symbol = NameAndValue('symbol name', 'symbol value (not used in test)')
        all_defined_symbols = frozenset((symbol.name, ))
        symbol_definition = StringConstantSymbolContext(
            symbol.name, symbol.value).definition
        symbol_usages_of_instruction_that_defines_symbol = [symbol_definition]

        expected_phase_2_step_2_names_set = {
            PhaseEnum.SETUP: {
                step.SETUP__VALIDATE_PRE_SDS.step: all_defined_symbols,
                step.SETUP__MAIN.step: set(),
                step.SETUP__VALIDATE_POST_SETUP.step: all_defined_symbols,
            },
            PhaseEnum.ACT: {
                step.ACT__VALIDATE_PRE_SDS.step: all_defined_symbols,
                step.ACT__VALIDATE_POST_SETUP.step: all_defined_symbols,
                step.ACT__EXECUTE.step: all_defined_symbols,
                step.ACT__PREPARE.step: all_defined_symbols,
            },
            PhaseEnum.BEFORE_ASSERT:
            psr.same_value_for_all_steps(step.ALL_BEFORE_ASSERT_WITH_ENV_ARG,
                                         all_defined_symbols),
            PhaseEnum.ASSERT:
            psr.same_value_for_all_steps(step.ALL_ASSERT_WITH_ENV_ARG,
                                         all_defined_symbols),
            PhaseEnum.CLEANUP:
            psr.same_value_for_all_steps(step.ALL_CLEANUP_WITH_ENV_ARG,
                                         all_defined_symbols),
        }
        actual_phase_2_step_2_names_set = psr.new_phase_enum_2_empty_dict()

        def recorder_for(phase_step: SimplePhaseStep):
            return psr.StepRecordingAction(
                phase_step, actual_phase_2_step_2_names_set,
                get_symbols_name_set_from_instruction_environment)

        test_case = partial_test_case_with_instructions(
            [
                setup_phase_instruction_that(
                    symbol_usages=do_return(
                        symbol_usages_of_instruction_that_defines_symbol),
                    validate_pre_sds_initial_action=recorder_for(
                        step.SETUP__VALIDATE_PRE_SDS),
                    main_initial_action=sequence_of_actions([
                        recorder_for(step.SETUP__MAIN),
                        _ActionThatSetsSymbolInSymbolTable(symbol_definition),
                    ]),
                    validate_post_setup_initial_action=recorder_for(
                        step.SETUP__VALIDATE_POST_SETUP),
                )
            ],
            psr.act_phase_instructions_that_does_nothing(),
            [
                psr.
                before_assert_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            [
                psr.assert_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            [
                psr.cleanup_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
        )
        test__va(
            self, test_case,
            Arrangement(
                psr.actor_that_records_a_value_per_step(
                    recorder_for, recorder_for_parse_step=psr.no_recording)),
            asrt.anything_goes())
        _check_result(self, expected_phase_2_step_2_names_set,
                      actual_phase_2_step_2_names_set)
예제 #12
0
    def test_one_symbol_is_predefined_and_one_symbol_is_defined_in_the_setup_phase(
            self):
        predefined_symbol = StringSymbolContext.of_constant(
            'predefined symbol', 'predefined string constant symbol value')
        defined_symbol = StringConstantSymbolContext(
            'defined symbol',
            'value of symbol defined in the setup phase (not used in this test)'
        )
        predefined_symbols_table = predefined_symbol.symbol_table
        predefined_symbols = frozenset((predefined_symbol.name, ))
        predefined_and_defined_symbols = frozenset(
            (predefined_symbol.name, defined_symbol.name))

        symbol_definition = defined_symbol.definition

        symbol_usages_of_instruction_that_defines_symbol = [symbol_definition]

        expected_phase_2_step_2_names_set = {
            PhaseEnum.SETUP: {
                step.SETUP__VALIDATE_PRE_SDS.step:
                predefined_and_defined_symbols,
                step.SETUP__MAIN.step:
                predefined_symbols,
                step.SETUP__VALIDATE_POST_SETUP.step:
                predefined_and_defined_symbols,
            },
            PhaseEnum.ACT: {
                step.ACT__VALIDATE_PRE_SDS.step:
                predefined_and_defined_symbols,
                step.ACT__VALIDATE_POST_SETUP.step:
                predefined_and_defined_symbols,
                step.ACT__PREPARE.step: predefined_and_defined_symbols,
                step.ACT__EXECUTE.step: predefined_and_defined_symbols,
            },
            PhaseEnum.BEFORE_ASSERT: {
                step.BEFORE_ASSERT__VALIDATE_PRE_SDS.step:
                predefined_and_defined_symbols,
                step.BEFORE_ASSERT__VALIDATE_POST_SETUP.step:
                predefined_and_defined_symbols,
                step.BEFORE_ASSERT__MAIN.step: predefined_and_defined_symbols,
            },
            PhaseEnum.ASSERT: {
                step.ASSERT__VALIDATE_PRE_SDS.step:
                predefined_and_defined_symbols,
                step.ASSERT__VALIDATE_POST_SETUP.step:
                predefined_and_defined_symbols,
                step.ASSERT__MAIN.step: predefined_and_defined_symbols,
            },
            PhaseEnum.CLEANUP: {
                step.CLEANUP__VALIDATE_PRE_SDS.step:
                predefined_and_defined_symbols,
                step.CLEANUP__MAIN.step: predefined_and_defined_symbols,
            },
        }
        actual_phase_2_step_2_names_set = psr.new_phase_enum_2_empty_dict()

        def recorder_for(phase_step: SimplePhaseStep):
            return psr.StepRecordingAction(
                phase_step, actual_phase_2_step_2_names_set,
                get_symbols_name_set_from_instruction_environment)

        test_case = partial_test_case_with_instructions(
            [
                setup_phase_instruction_that(
                    symbol_usages=do_return(
                        symbol_usages_of_instruction_that_defines_symbol),
                    validate_pre_sds_initial_action=recorder_for(
                        step.SETUP__VALIDATE_PRE_SDS),
                    main_initial_action=sequence_of_actions([
                        recorder_for(step.SETUP__MAIN),
                        _ActionThatSetsSymbolInSymbolTable(symbol_definition),
                    ]),
                    validate_post_setup_initial_action=recorder_for(
                        step.SETUP__VALIDATE_POST_SETUP),
                )
            ],
            psr.act_phase_instructions_that_does_nothing(),
            [
                psr.
                before_assert_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            [
                psr.assert_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
            [
                psr.cleanup_phase_instruction_that_records_a_value_per_step(
                    recorder_for)
            ],
        )
        test__va(
            self, test_case,
            Arrangement(actor=psr.actor_that_records_a_value_per_step(
                recorder_for, recorder_for_parse_step=psr.no_recording),
                        predefined_symbols=predefined_symbols_table),
            asrt.anything_goes())
        _check_result(self, expected_phase_2_step_2_names_set,
                      actual_phase_2_step_2_names_set)