def test_that_nested_groups_up_to_four_layers_are_possible(self):
        add_directory_structure(
            ["testGroup1", "testGroup2", "testGroup3", "testGroup4"])

        self.assert_group1_is_inside_group2("testGroup2", "testGroup1")
        self.assert_group1_is_inside_group2("testGroup3", "testGroup2")
        self.assert_group1_is_inside_group2("testGroup4", "testGroup3")
    def test_that_for_two_names_the_second_group_is_nested_inside_the_first(self):
        add_directory_structure(["testGroup1", "testGroup2"])

        self.assert_group_workspace_exists("testGroup1")
        self.assert_group_workspace_exists("testGroup2")

        self.assert_group1_is_inside_group2("testGroup2", "testGroup1")
    def test_that_passing_a_list_of_strings_creates_a_group_for_each_string(self):
        add_directory_structure(["testGroup1", "testGroup2", "testGroup3"])

        self.assertEqual(simpleapi.mtd.size(), 3)
        self.assert_group_workspace_exists("testGroup1")
        self.assert_group_workspace_exists("testGroup2")
        self.assert_group_workspace_exists("testGroup3")
Пример #4
0
    def test_that_for_two_names_the_second_group_is_nested_inside_the_first(self):
        add_directory_structure(["testGroup1", "testGroup2"])

        self.assert_group_workspace_exists("testGroup1")
        self.assert_group_workspace_exists("testGroup2")

        self.assert_group1_is_inside_group2("testGroup2", "testGroup1")
Пример #5
0
    def test_that_passing_a_list_of_strings_creates_a_group_for_each_string(self):
        add_directory_structure(["testGroup1", "testGroup2", "testGroup3"])

        self.assertEqual(simpleapi.mtd.size(), 3)
        self.assert_group_workspace_exists("testGroup1")
        self.assert_group_workspace_exists("testGroup2")
        self.assert_group_workspace_exists("testGroup3")
    def test_that_overwriting_previous_structure_with_a_permutation_works(self):
        add_directory_structure(["testGroup1", "testGroup2", "testGroup3", "testGroup4"])

        add_directory_structure(["testGroup4", "testGroup3", "testGroup2", "testGroup1"])

        self.assert_group1_is_inside_group2("testGroup1", "testGroup2")
        self.assert_group1_is_inside_group2("testGroup2", "testGroup3")
        self.assert_group1_is_inside_group2("testGroup3", "testGroup4")
Пример #7
0
    def test_that_overwriting_previous_structure_with_a_permutation_works(self):
        add_directory_structure(["testGroup1", "testGroup2", "testGroup3", "testGroup4"])

        add_directory_structure(["testGroup4", "testGroup3", "testGroup2", "testGroup1"])

        self.assert_group1_is_inside_group2("testGroup1", "testGroup2")
        self.assert_group1_is_inside_group2("testGroup2", "testGroup3")
        self.assert_group1_is_inside_group2("testGroup3", "testGroup4")
    def test_that_if_workspace_already_exists_it_is_removed(self):
        workspace = create_simple_workspace(data_x=[1, 2, 3, 4], data_y=[10, 10, 10, 10])
        simpleapi.mtd.add("testGroup1", workspace)

        add_directory_structure(["testGroup1", "testGroup2"])

        self.assert_group_workspace_exists("testGroup1")
        self.assert_group_workspace_exists("testGroup2")
        self.assert_group1_is_inside_group2("testGroup2", "testGroup1")
    def test_that_passing_a_list_of_a_single_string_creates_an_empty_group_in_ADS(self):
        add_directory_structure(["testGroup"])

        self.assertEqual(simpleapi.mtd.size(), 1)
        self.assertTrue(simpleapi.mtd.doesExist("testGroup"))
        self.assertEqual(type(simpleapi.mtd.retrieve("testGroup")), WorkspaceGroup)

        group = simpleapi.mtd.retrieve("testGroup")
        self.assertEqual(group.getNumberOfEntries(), 0)
Пример #10
0
    def test_that_if_workspace_already_exists_it_is_removed(self):
        workspace = create_simple_workspace(data_x=[1, 2, 3, 4], data_y=[10, 10, 10, 10])
        simpleapi.mtd.add("testGroup1", workspace)

        add_directory_structure(["testGroup1", "testGroup2"])

        self.assert_group_workspace_exists("testGroup1")
        self.assert_group_workspace_exists("testGroup2")
        self.assert_group1_is_inside_group2("testGroup2", "testGroup1")
Пример #11
0
    def test_that_passing_a_list_of_a_single_string_creates_an_empty_group_in_ADS(self):
        add_directory_structure(["testGroup"])

        self.assertEqual(simpleapi.mtd.size(), 1)
        self.assertTrue(simpleapi.mtd.doesExist("testGroup"))
        self.assertEqual(type(simpleapi.mtd.retrieve("testGroup")), WorkspaceGroup)

        group = simpleapi.mtd.retrieve("testGroup")
        self.assertEqual(group.getNumberOfEntries(), 0)
    def test_raises_ValueError_if_duplicate_names_given(self):
        # this is necessary due to the ADS requiring all names to be unique irrespectie of object
        # type or nesting

        with self.assertRaises(ValueError):
            add_directory_structure(["testGroup1", "testGroup2", "testGroup2"])
    def test_that_passing_empty_list_has_no_effect(self):
        add_directory_structure([])

        self.assertEqual(simpleapi.mtd.size(), 0)
    def test_that_nested_groups_up_to_four_layers_are_possible(self):
        add_directory_structure(["testGroup1", "testGroup2", "testGroup3", "testGroup4"])

        self.assert_group1_is_inside_group2("testGroup2", "testGroup1")
        self.assert_group1_is_inside_group2("testGroup3", "testGroup2")
        self.assert_group1_is_inside_group2("testGroup4", "testGroup3")
    def test_raises_ValueError_if_duplicate_names_given(self):
        # this is necessary due to the ADS requiring all names to be unique irrespectie of object
        # type or nesting

        with self.assertRaises(ValueError):
            add_directory_structure(["testGroup1", "testGroup2", "testGroup2"])
    def test_that_passing_empty_list_has_no_effect(self):
        add_directory_structure([])

        self.assertEqual(simpleapi.mtd.size(), 0)