def test_that_contains_is_true_when_data_contains_entries_which_match_to_at_least_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.assertTrue(data.contains(run=1234, filename="C:\\dir1\\file2.nxs")) self.assertTrue(data.contains(run=1234, workspace=[3]))
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_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_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"))