Beispiel #1
0
    def test_data_can_be_added_correctly_via_keyword_args(self):
        data = MuonLoadData()
        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")

        self.assertEqual(data.num_items(), 1)
        self.assertEqual(data.contains_n(run=1234), 1)
        self.assertEqual(data.contains_n(workspace=[1]), 1)
        self.assertEqual(data.contains_n(filename="C:\\dir1\\file1.nxs"), 1)
Beispiel #2
0
    def test_counting_entries_with_keyword_argument_gives_correct_count(self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1235, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")

        self.assertEqual(data.contains_n(run=1234), 2)
        self.assertEqual(data.contains_n(filename="C:\\dir1\\file1.nxs"), 1)
        self.assertEqual(data.contains_n(run=9999), 0)
Beispiel #3
0
    def test_that_remove_method_can_remove_several_entries_at_once(self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1234, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")
        self.assertEqual(data.num_items(), 3)

        data.remove_data(run=1234)

        self.assert_empty(data)
Beispiel #4
0
    def test_that_contains_is_false_when_data_contains_entries_which_match_to_only_one_of_multiple_keywords(
            self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1235, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")

        # values from keywords correspond to different entries
        self.assertFalse(
            data.contains(run=1234, filename="C:\\dir1\\file2.nxs"))
        self.assertTrue(data.contains(run=1234, workspace=[3]))
Beispiel #5
0
    def test_that_contains_is_true_when_data_contains_entry_which_matches_to_a_single_keyword_and_false_otherwise(
            self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1235, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")

        self.assertTrue(data.contains(run=1234))
        self.assertTrue(data.contains(filename="C:\\dir1\\file1.nxs"))

        self.assertFalse(data.contains(run=9999))
        self.assertFalse(data.contains(filename="C:\\dir1\\file4.nxs"))
Beispiel #6
0
    def test_counting_entries_applies_AND_behaviour_to_keyword_arguments(self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1235, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")
        data.add_data(run=1236, workspace=[4], filename="C:\\dir1\\file4.nxs")

        self.assertEqual(data.contains_n(run=1234, workspace=[1]), 1)
        self.assertEqual(data.contains_n(run=1234, workspace=[2]), 0)
        self.assertEqual(
            data.contains_n(run=1234,
                            workspace=[2],
                            filename="C:\\dir1\\file4.nxs"), 0)
Beispiel #7
0
 def populate_loaded_data(self):
     data = MuonLoadData()
     data.add_data(run=1234,
                   workspace=[1],
                   filename="C:\\dir1\\file1.nxs",
                   instrument='EMU')
     data.add_data(run=1235,
                   workspace=[2],
                   filename="C:\\dir1\\file2.nxs",
                   instrument='EMU')
     data.add_data(run=1236,
                   workspace=[3],
                   filename="C:\\dir1\\file3.nxs",
                   instrument='EMU')
     return data
Beispiel #8
0
    def test_that_adding_then_removing_single_item_leaves_data_empty(self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        self.assertEqual(data.num_items(), 1)
        data.remove_data(run=1234)

        self.assert_empty(data)

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.remove_data(workspace=[1])
        self.assert_empty(data)

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.remove_data(filename="C:\\dir1\\file1.nxs")
        self.assert_empty(data)
Beispiel #9
0
class EAGroupContextTest(unittest.TestCase):
    def setUp(self):
        self.context = EAGroupContext()
        self.loadedData = MuonLoadData()

    def create_group_workspace_and_load(self):
        grpws = WorkspaceGroup()
        ws_detector1 = '9999; Detector 1'
        grpws.addWorkspace(CreateSampleWorkspace(OutputWorkspace=ws_detector1))
        ws_detector2 = '9999; Detector 2'
        grpws.addWorkspace(CreateSampleWorkspace(OutputWorkspace=ws_detector2))
        run = 9999
        self.loadedData.add_data(run=[run], workspace=grpws)

    # ------------------------------------------------------------------------------------------------------------------
    # TESTS
    # ------------------------------------------------------------------------------------------------------------------

    def test_add_new_group(self):
        self.loadedData.clear()
        self.create_group_workspace_and_load()
        empty_group = []
        new_group = self.context.add_new_group(empty_group, self.loadedData)
        self.assertEqual(len(new_group), 2)

    def test_remove_group(self):
        self.loadedData.clear()
        self.create_group_workspace_and_load()
        self.context.reset_group_to_default(self.loadedData)
        self.assertEqual(len(self.context.groups), 2)
        group_name1 = '9999; Detector 1'
        self.assertTrue(group_name1 in self.context.group_names)

        self.context.remove_group(group_name1)
        self.assertFalse(group_name1 in self.context.group_names)

    def test_reset_group_to_default(self):
        self.loadedData.clear()
        self.assertEqual(self.loadedData.num_items(), 0)
        self.create_group_workspace_and_load()
        self.context.reset_group_to_default(self.loadedData)
        self.assertEqual(len(self.context.groups), 2)

    def test_clear(self):
        self.loadedData.clear()
        self.create_group_workspace_and_load()
        self.context.reset_group_to_default(self.loadedData)
        self.assertEqual(len(self.context.groups), 2)

        self.context.clear()
        self.assertEqual(len(self.context.groups), 0)

    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_rebinned_workspace"
    )
    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_peak_table"
    )
    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_matches_group"
    )
    def test_remove_rebinned_workspace_from_group(self, mock_remove_matches,
                                                  mock_remove_peak,
                                                  mock_remove_rebinned):
        mock_group = EAGroup("9999; Detector 1", "detector 1", "9999")
        self.context.add_group(mock_group)
        self.context.remove_workspace_from_group(
            '9999; Detector 1_EA_Rebinned_Fixed')
        mock_remove_rebinned.assert_called_once()
        mock_remove_peak.assert_not_called()
        mock_remove_matches.assert_not_called()

    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_rebinned_workspace"
    )
    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_peak_table"
    )
    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_matches_group"
    )
    def test_remove_peak_table_from_group(self, mock_remove_matches,
                                          mock_remove_peak,
                                          mock_remove_rebinned):
        mock_group = EAGroup("9999; Detector 1", "detector 1", "9999")
        self.context.add_group(mock_group)
        self.context.remove_workspace_from_group(
            '9999; Detector 1_EA_peak_table')
        mock_remove_rebinned.assert_not_called()
        mock_remove_peak.aassert_called_once()
        mock_remove_matches.assert_not_called()

    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_rebinned_workspace"
    )
    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_peak_table"
    )
    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_matches_group"
    )
    def test_remove_matches_table_from_group(self, mock_remove_matches,
                                             mock_remove_peak,
                                             mock_remove_rebinned):
        mock_group = EAGroup("9999; Detector 1", "detector 1", "9999")
        self.context.add_group(mock_group)
        self.context.remove_workspace_from_group('9999; Detector 1_EA_matches')
        mock_remove_rebinned.assert_not_called()
        mock_remove_peak.aassert_not_called()
        mock_remove_matches.assert_called_once()

    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_rebinned_workspace"
    )
    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_peak_table"
    )
    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.EAGroup.remove_matches_group"
    )
    def test_remove_workspace_from_group_when_not_in_group(
            self, mock_remove_matches, mock_remove_peak, mock_remove_rebinned):
        mock_group = EAGroup("9999; Detector 1", "detector 1", "9999")
        self.context.add_group(mock_group)
        self.context.remove_workspace_from_group('mock_workspace')
        mock_remove_rebinned.assert_not_called()
        mock_remove_peak.aassert_not_called()
        mock_remove_matches.assert_not_called()

    @mock.patch(
        "mantidqtinterfaces.Muon.GUI.ElementalAnalysis2.ea_group.remove_ws_if_present"
    )
    def test_error_raised_when_deleting_EAGroup(self, mock_remove_ws):
        self.loadedData.clear()
        self.create_group_workspace_and_load()
        self.context.reset_group_to_default(self.loadedData)
        self.assertEqual(len(self.context.groups), 2)
        group_name1 = '9999; Detector 1'
        self.assertTrue(group_name1 in self.context.group_names)
        mock_remove_ws.side_effect = ValueError("mock error")
        error_notifier_mock = mock.Mock()
        self.context[group_name1].error_notifier = error_notifier_mock

        self.context.remove_group(group_name1)
        self.assertFalse(group_name1 in self.context.group_names)
        mock_remove_ws.assert_called_once_with(group_name1)
        error_notifier_mock.notify_subscribers.assert_called_once_with(
            f"Unexpected error occurred when"
            f" deleting group {group_name1}: mock error")
class MuonDataContextTest(unittest.TestCase):
    def setUp(self):
        self.filepath = FileFinder.findRuns('EMU00019489.nxs')[0]
        self.load_result, self.run_number, self.filename, _ = load_workspace_from_filename(
            self.filepath)
        self.loaded_data = MuonLoadData()
        self.context = MuonDataContext(load_data=self.loaded_data)
        self.context.instrument = 'EMU'

        self.loaded_data.add_data(workspace=self.load_result,
                                  run=[self.run_number],
                                  filename=self.filename,
                                  instrument='EMU')
        self.context.current_runs = [[self.run_number]]
        self.context.update_current_data()

    def tearDown(self):
        AnalysisDataService.clear()

    def test_setting_current_data_with_a_different_field_sends_message_signal(
            self):
        self.context.current_data['MainFieldDirection'] = 'transverse'
        self.context.message_notifier.notify_subscribers = mock.MagicMock()

        self.context.update_current_data()

        self.context.message_notifier.notify_subscribers.assert_called_once_with(
            'MainFieldDirection has changed between'
            ' data sets, click default to reset grouping if required')
        self.context.current_data['MainFieldDirection'] = 'longitudinal'

    def test_that_setting_current_runs_with_mixture_of_transverse_and_longitudanal_runs_raises_warning(
            self):
        loaded_data = copy.copy(self.context.current_data)
        self.context.message_notifier.notify_subscribers = mock.MagicMock()
        loaded_data['MainFieldDirection'] = 'transverse'

        self.loaded_data.add_data(workspace=loaded_data,
                                  run=[1],
                                  filename='filename',
                                  instrument='EMU')

        self.context.current_runs = [[19489], [1]]

        self.context.message_notifier.notify_subscribers.assert_called_once_with(
            'MainFieldDirection changes within current run set:\ntransverse field runs 1\nlongitudinal field runs 19489\n'
        )

    def test_is_data_loaded_returns_true_if_data_loaded(self):
        self.assertTrue(self.context.is_data_loaded())

    def test_is_data_loaded_returns_false_if_no_data_loaded(self):
        self.context._loaded_data.clear()
        self.assertFalse(self.context.is_data_loaded())

    def test_current_filenames_returns_path_to_current_file(self):
        self.assertEqual(self.context.current_filenames, [self.filepath])

    def test_current_runs_set_correctly(self):
        self.assertEqual(self.context.current_runs, [[19489]])

    def test_current_workspaces_returns_correctly(self):
        self.assertEqual(self.context.current_workspaces, [self.load_result])

    def test_get_loaded_data_for_run_returns_correctly(self):
        self.assertEqual(self.context.get_loaded_data_for_run([19489]),
                         self.load_result)

    def test_num_detectors_returns_correctly(self):
        self.assertEqual(self.context.num_detectors, 96)

    def test_num_periods_returns_correctly(self):
        self.assertEqual(self.context.num_periods([19489]), 1)

    def test_main_field_direction_returns_correctly(self):
        self.assertEqual(self.context.main_field_direction, 'Longitudinal')

    def test_dead_time_table_returns_correctly(self):
        self.assertEqual(self.context.dead_time_table,
                         self.load_result['DeadTimeTable'])

    def test_return_sample_log_returns_correctly(self):
        self.assertEqual(self.context.get_sample_log('goodfrm').value, 31369.0)

    def test_that_is_multi_period_returns_false_for_single_period_data(self):
        is_multi_period = self.context.is_multi_period()

        self.assertTrue(not is_multi_period)

    def test_that_any_multi_period_data_will_mark_everything_as_multiperiod(
            self):
        multi_period_worspace_list = [
            MuonWorkspaceWrapper(f'raw_data_{period_index + 1}')
            for period_index in range(4)
        ]
        load_result = {'OutputWorkspace': multi_period_worspace_list}
        self.loaded_data.add_data(workspace=load_result,
                                  run=[84447],
                                  filename='workspace_filename',
                                  instrument='EMU')
        self.context._current_runs = [[84447], [19489]]

        is_multi_period = self.context.is_multi_period()

        self.assertTrue(is_multi_period)
Beispiel #11
0
class MuonLoadDataTest(unittest.TestCase):
    def setUp(self):
        self.muon_load_data = MuonLoadData()
        self.workspace = mock.MagicMock()
        self.workspace_last = mock.MagicMock()
        self.muon_load_data.add_data(run=1,
                                     workspace=mock.MagicMock(),
                                     filename='path to file')
        self.muon_load_data.add_data(run=2,
                                     workspace=self.workspace,
                                     filename='path to file')
        self.muon_load_data.add_data(run=3,
                                     workspace=mock.MagicMock(),
                                     filename='matching path')
        self.muon_load_data.add_data()
        self.muon_load_data.add_data(run=4,
                                     workspace=self.workspace_last,
                                     filename='path to file')

    def assert_empty(self, load_data):
        self.assertEqual(load_data.get_parameter("run"), [])
        self.assertEqual(load_data.get_parameter("workspace"), [])
        self.assertEqual(load_data.get_parameter("filename"), [])

        self.assertEqual(load_data.num_items(), 0)

    def assert_unchanged(self, load_data):
        self.assertEqual(load_data.get_parameter("run"), [1234, 1235, 1236])
        self.assertEqual(load_data.get_parameter("workspace"), [[1], [2], [3]])
        self.assertEqual(load_data.get_parameter("filename"), [
            "C:\\dir1\\file1.nxs", "C:\\dir1\\file2.nxs", "C:\\dir1\\file3.nxs"
        ])

        self.assertEqual(load_data.num_items(), 3)

    def populate_loaded_data(self):
        data = MuonLoadData()
        data.add_data(run=1234,
                      workspace=[1],
                      filename="C:\\dir1\\file1.nxs",
                      instrument='EMU')
        data.add_data(run=1235,
                      workspace=[2],
                      filename="C:\\dir1\\file2.nxs",
                      instrument='EMU')
        data.add_data(run=1236,
                      workspace=[3],
                      filename="C:\\dir1\\file3.nxs",
                      instrument='EMU')
        return data

    # ------------------------------------------------------------------------------------------------------------------
    # TESTS
    # ------------------------------------------------------------------------------------------------------------------

    def test_load_data_initialized_as_empty(self):
        data = MuonLoadData()
        self.assert_empty(data)

    def test_data_can_be_added_correctly_via_keyword_args(self):
        data = MuonLoadData()
        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")

        self.assertEqual(data.num_items(), 1)
        self.assertEqual(data.contains_n(run=1234), 1)
        self.assertEqual(data.contains_n(workspace=[1]), 1)
        self.assertEqual(data.contains_n(filename="C:\\dir1\\file1.nxs"), 1)

    def test_that_clear_empties_the_data_of_all_entries(self):
        data = self.populate_loaded_data()
        self.assertEqual(data.num_items(), 3)

        data.clear()

        self.assert_empty(data)

    def test_that_adding_then_removing_single_item_leaves_data_empty(self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        self.assertEqual(data.num_items(), 1)
        data.remove_data(run=1234)

        self.assert_empty(data)

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.remove_data(workspace=[1])
        self.assert_empty(data)

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.remove_data(filename="C:\\dir1\\file1.nxs")
        self.assert_empty(data)

    def test_that_remove_method_can_remove_several_entries_at_once(self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1234, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")
        self.assertEqual(data.num_items(), 3)

        data.remove_data(run=1234)

        self.assert_empty(data)

    def test_that_remove_method_applies_AND_to_multiple_keyword_arguments(
            self):
        data = self.populate_loaded_data()
        self.assertEqual(data.num_items(), 3)

        data.remove_data(run=1234,
                         workspace=[2],
                         filename="C:\\dir1\\file3.nxs")

        self.assert_unchanged(data)

    def test_that_contains_is_true_when_data_contains_entry_which_matches_to_a_single_keyword_and_false_otherwise(
            self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1235, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")

        self.assertTrue(data.contains(run=1234))
        self.assertTrue(data.contains(filename="C:\\dir1\\file1.nxs"))

        self.assertFalse(data.contains(run=9999))
        self.assertFalse(data.contains(filename="C:\\dir1\\file4.nxs"))

    def test_that_contains_is_false_when_data_contains_entries_which_match_to_only_one_of_multiple_keywords(
            self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1235, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")

        # values from keywords correspond to different entries
        self.assertFalse(
            data.contains(run=1234, filename="C:\\dir1\\file2.nxs"))
        self.assertTrue(data.contains(run=1234, workspace=[3]))

    def test_counting_entries_with_keyword_argument_gives_correct_count(self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1235, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")

        self.assertEqual(data.contains_n(run=1234), 2)
        self.assertEqual(data.contains_n(filename="C:\\dir1\\file1.nxs"), 1)
        self.assertEqual(data.contains_n(run=9999), 0)

    def test_counting_entries_applies_AND_behaviour_to_keyword_arguments(self):
        data = MuonLoadData()

        data.add_data(run=1234, workspace=[1], filename="C:\\dir1\\file1.nxs")
        data.add_data(run=1235, workspace=[2], filename="C:\\dir1\\file2.nxs")
        data.add_data(run=1234, workspace=[3], filename="C:\\dir1\\file3.nxs")
        data.add_data(run=1236, workspace=[4], filename="C:\\dir1\\file4.nxs")

        self.assertEqual(data.contains_n(run=1234, workspace=[1]), 1)
        self.assertEqual(data.contains_n(run=1234, workspace=[2]), 0)
        self.assertEqual(
            data.contains_n(run=1234,
                            workspace=[2],
                            filename="C:\\dir1\\file4.nxs"), 0)

    def test_iterator_behaviour_of_data(self):
        data = self.populate_loaded_data()

        check = [{
            "run": 1234,
            "workspace": [1],
            "filename": "C:\\dir1\\file1.nxs",
            'instrument': 'EMU'
        }, {
            "run": 1235,
            "workspace": [2],
            "filename": "C:\\dir1\\file2.nxs",
            'instrument': 'EMU'
        }, {
            "run": 1236,
            "workspace": [3],
            "filename": "C:\\dir1\\file3.nxs",
            'instrument': 'EMU'
        }]

        for data_item in iter(data):
            self.assertEqual(data_item, check.pop(0))

    def test_that_remove_current_data_removes_the_most_recently_added_data(
            self):
        data = self.populate_loaded_data()

        data.remove_current_data()

        check = [{
            "run": 1234,
            "workspace": [1],
            "filename": "C:\\dir1\\file1.nxs",
            'instrument': 'EMU'
        }, {
            "run": 1235,
            "workspace": [2],
            "filename": "C:\\dir1\\file2.nxs",
            'instrument': 'EMU'
        }]

        for data_item in iter(data):
            self.assertEqual(data_item, check.pop(0))

    def test_that_remove_last_added_data_removes_the_previous_data_item_before_the_most_recent(
            self):
        data = self.populate_loaded_data()

        data.remove_last_added_data()

        check = [{
            "run": 1234,
            "workspace": [1],
            "filename": "C:\\dir1\\file1.nxs",
            'instrument': 'EMU'
        }, {
            "run": 1236,
            "workspace": [3],
            "filename": "C:\\dir1\\file3.nxs",
            'instrument': 'EMU'
        }]

        for data_item in iter(data):
            self.assertEqual(data_item, check.pop(0))

    def test_that_can_add_data_to_struct(self):
        self.assertEqual(self.muon_load_data.num_items(), 5)
        self.assertEqual(self.muon_load_data.get_parameter('run')[2], 3)
        self.assertEqual(
            self.muon_load_data.get_parameter('workspace')[1], self.workspace)
        self.assertEqual(
            self.muon_load_data.get_parameter('filename')[0], 'path to file')

    def test_that_matches_returns_false_for_all_entries_with_only_one_match(
            self):
        match_list = self.muon_load_data._matches(run=1,
                                                  workspace=self.workspace,
                                                  filename='matching path')

        self.assertEqual(match_list, [False, False, False, False, False])

    def test_that_matches_with_no_params_matches_all(self):
        match_list = self.muon_load_data._matches()

        self.assertEqual(match_list, [True, True, True, True, True])

    def test_that_matches_with_unused_parameters_match_none(self):
        match_list = self.muon_load_data._matches(new_info='new info')

        self.assertEqual(match_list, [False, False, False, False, False])

    def test_that_matches_correctly_with_only_one_parameter_given(self):
        match_list = self.muon_load_data._matches(filename='path to file')

        self.assertEqual(match_list, [True, True, False, False, True])

    def test_that_get_data_returns_correct_dict(self):
        data_dict = self.muon_load_data.get_data(run=2)

        self.assertEqual(
            data_dict, {
                'workspace': self.workspace,
                'filename': 'path to file',
                'run': 2,
                'instrument': ''
            })

    def test_that_get_latest_data_returns_correct_dict(self):
        data_dict = self.muon_load_data.get_latest_data()

        self.assertEqual(
            data_dict, {
                'workspace': self.workspace_last,
                'filename': 'path to file',
                'run': 4,
                'instrument': ''
            })