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_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_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_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_OR_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]), 2) self.assertEqual(data.contains_n(run=1234, workspace=[2]), 3) self.assertEqual(data.contains_n(run=1234, workspace=[2], filename="C:\\dir1\\file4.nxs"), 4)
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)