def test_that_get_workspace_names_to_display_from_context_only_returns_the_names_that_exist_in_the_ADS(self):
        self.model.context.results_context.result_table_names = self.result_table_names

        table_workspace = WorkspaceFactory.createTable()
        add_ws_to_ads("Result1", table_workspace)

        self.assertEqual(self.model.get_workspace_names_to_display_from_context(), ["Result1"])
    def setUp(self):
        self.results_context = ResultsContext()
        self.result_table_names = ["Name1", "Name2"]

        workspace = WorkspaceFactory.create("Workspace2D",
                                            NVectors=3,
                                            YLength=5,
                                            XLength=5)
        add_ws_to_ads("Name1", workspace)
        add_ws_to_ads("Name2", workspace)
    def _create_workspace_group_to_store_combination_workspaces(
            self) -> WorkspaceGroup:
        """Return the Workspace Group used to store the different parameter combination matrix workspaces."""
        group_name = self.parameter_combination_group_name()
        if group_name is None:
            return None

        if check_if_workspace_exist(group_name):
            workspace_group = retrieve_ws(group_name)
        else:
            workspace_group = WorkspaceGroup()
            add_ws_to_ads(group_name, workspace_group)
        return workspace_group
    def test_that_create_x_and_y_parameter_combination_workspaces_will_create_the_expected_parameter_workspaces(self):
        self.model.result_table_names = self.result_table_names
        self.model.current_result_table_index = 0

        table = create_results_table()
        add_ws_to_ads("Result1", table)

        self.model.create_x_and_y_parameter_combination_workspaces()

        self.assertTrue(check_if_workspace_exist("Result1; Parameter Combinations"))

        self.assertTrue(check_if_workspace_exist("Result1; workspace_name vs A0"))
        self.assertTrue(check_if_workspace_exist("Result1; workspace_name vs A1"))
        self.assertTrue(check_if_workspace_exist("Result1; A0 vs workspace_name"))
        self.assertTrue(check_if_workspace_exist("Result1; A0 vs A1"))
        self.assertTrue(check_if_workspace_exist("Result1; A1 vs workspace_name"))
        self.assertTrue(check_if_workspace_exist("Result1; A1 vs A0"))

        self.assertTrue(not check_if_workspace_exist("Result1; workspace_name vs workspace_name"))
        self.assertTrue(not check_if_workspace_exist("Result1; A0 vs A0"))
        self.assertTrue(not check_if_workspace_exist("Result1; A1 vs A1"))
    def test_that_create_x_and_y_parameter_combination_workspaces_will_create_the_expected_parameter_data(self):
        self.model.result_table_names = self.result_table_names
        self.model.current_result_table_index = 0

        table = create_results_table()
        add_ws_to_ads("Result1", table)

        self.model.create_x_and_y_parameter_combination_workspaces()
        x_parameters = self.model.x_parameters()
        y_parameters = self.model.y_parameters()

        self.assertEqual(list(x_parameters), ["workspace_name", "A0", "A1"])
        self.assertEqual(list(y_parameters), ["workspace_name", "A0", "A1"])

        self.assertAlmostEqual(self.model.fitting_context.x_parameters["A0"][0], 0.1, delta=0.000001)
        self.assertAlmostEqual(self.model.fitting_context.x_parameters["A0"][1], 0.3, delta=0.000001)
        self.assertAlmostEqual(self.model.fitting_context.x_parameters["A0"][2], 0.5, delta=0.000001)
        self.assertAlmostEqual(self.model.fitting_context.y_parameters["A1"][0], 0.2, delta=0.000001)
        self.assertAlmostEqual(self.model.fitting_context.y_parameters["A1"][1], 0.4, delta=0.000001)
        self.assertAlmostEqual(self.model.fitting_context.y_parameters["A1"][2], 0.6, delta=0.000001)

        self.assertEqual(self.model.fitting_context.y_parameters["workspace_name"],
                         ["MUSR62260; Group; bottom; Asymmetry; MA", "MUSR62260; Group; top; Asymmetry; MA",
                          "MUSR62260; Group; fwd; Asymmetry; MA"])