示例#1
0
    def test_generic_drop_with_invalid_object(self):
        # Setup test class, which won't be valid to drop()
        class InvalidDropObject:
            pass
        test_object = InvalidDropObject()

        # Call drop() with the test object
        with self.assertRaises(AttributeError):
            ta.drop(test_object)
示例#2
0
    def test_generic_drop_with_invalid_object(self):
        # Setup test class, which won't be valid to drop()
        class InvalidDropObject:
            pass

        test_object = InvalidDropObject()

        # Call drop() with the test object
        with self.assertRaises(AttributeError):
            ta.drop(test_object)
示例#3
0
    def test_generic_drop_with_list(self):
        frame_name1 = str(uuid.uuid1()).replace('-', '_')
        frame1 = ta.Frame(name=frame_name1)
        frame_name2 = str(uuid.uuid1()).replace('-', '_')
        ta.Frame(name=frame_name2)

        # Create list with frame proxy object and frame name
        frameList = [frame1, frame_name2]

        # Check that the frames we just created now exist
        self.assertTrue(
            frame_name1 in ta.get_frame_names(),
            frame_name1 + " should exist in the list of frame names")
        self.assertTrue(
            frame_name2 in ta.get_frame_names(),
            frame_name2 + " should exist in the list of frame names")

        self.assertEqual(
            2, ta.drop(frameList),
            "drop() should have deleted the 2 items from the list")

        # Check that the frames no longer exist
        self.assertFalse(
            frame_name1 in ta.get_frame_names(),
            frame_name1 + " should not be in the list of frame names")
        self.assertFalse(
            frame_name2 in ta.get_frame_names(),
            frame_name2 + " should not be in the list of frame names")
示例#4
0
    def test_generic_drop_by_invalid_name(self):
        frame_name = str(uuid.uuid1()).replace('-', '_')
        self.assertTrue(frame_name not in ta.get_frame_names(),
                        frame_name + " should not exist in the list of frames")

        # Verify that calling drop on a frame that does not exist does not fail
        self.assertEqual(
            0, ta.drop(frame_name),
            "drop() with a non-existent item name should not have deleted items"
        )
示例#5
0
    def test_generic_drop_by_name(self):
        model_name =  str(uuid.uuid1()).replace('-','_')

        ta.KMeansModel(name=model_name)
        self.assertTrue(model_name in ta.get_model_names(), model_name + " should exist in the list of model names")

        # drop() item by name
        self.assertEqual(1, ta.drop(model_name), "drop() should have deleted one item")

        # check that the model no longer exists
        self.assertFalse(model_name in ta.get_model_names(), model_name + " should not exist in the list of models")
示例#6
0
    def test_generic_drop_by_name(self):
        model_name =  str(uuid.uuid1()).replace('-','_')

        ta.KMeansModel(name=model_name)
        self.assertTrue(model_name in ta.get_model_names(), model_name + " should exist in the list of model names")

        # drop() item by name
        self.assertEqual(1, ta.drop(model_name), "drop() should have deleted one item")

        # check that the model no longer exists
        self.assertFalse(model_name in ta.get_model_names(), model_name + " should not exist in the list of models")
示例#7
0
    def test_generic_drop_duplicate_items(self):
        frame_name = str(uuid.uuid1()).replace('-','_')
        frame = ta.Frame(name=frame_name)

        # Check that the frame we just created now exists
        self.assertTrue(frame_name in ta.get_frame_names(), frame_name + " should exist in the list of frame names")

        self.assertEqual(1, ta.drop(frame, frame, frame_name), "drop() should have deleted 1 item")

        # Check that the frame no longer exists
        self.assertFalse(frame_name in ta.get_frame_names(), frame_name + " should not be in the list of frame names")
示例#8
0
    def test_generic_drop_by_name(self):
        # Create graph
        graph_name = str(uuid.uuid1()).replace("-", "_")
        graph = ta.Graph(name=graph_name)

        # Check that the graph we just created now exists
        self.assertTrue(graph_name in ta.get_graph_names(), graph_name + " should exist in the list of graph names")

        # drop item using graph name
        self.assertEqual(1, ta.drop(graph_name), "drop() should have deleted one item")

        # check that the graph no longer exists
        self.assertFalse(graph_name in ta.get_graph_names(), graph_name + " should not exist in the list of graph")
示例#9
0
    def test_generic_drop_by_object(self):
        model_name =  str(uuid.uuid1()).replace('-','_')

        model = ta.KMeansModel(name=model_name)

        # Check that the model we just created now exists
        self.assertTrue(model_name in ta.get_model_names(), model_name + " should exist in the list of model names")

        # drop by entity
        self.assertEqual(1, ta.drop(model), "drop() should have deleted one item")

        # check that the model no longer exists
        self.assertFalse(model_name in ta.get_model_names(), model_name + " should not exist in the list of models")
示例#10
0
    def test_generic_drop_by_object(self):
        model_name =  str(uuid.uuid1()).replace('-','_')

        model = ta.KMeansModel(name=model_name)

        # Check that the model we just created now exists
        self.assertTrue(model_name in ta.get_model_names(), model_name + " should exist in the list of model names")

        # drop by entity
        self.assertEqual(1, ta.drop(model), "drop() should have deleted one item")

        # check that the model no longer exists
        self.assertFalse(model_name in ta.get_model_names(), model_name + " should not exist in the list of models")
示例#11
0
    def test_generic_drop_duplicate_items(self):
        frame_name = str(uuid.uuid1()).replace('-', '_')
        frame = ta.Frame(name=frame_name)

        # Check that the frame we just created now exists
        self.assertTrue(
            frame_name in ta.get_frame_names(),
            frame_name + " should exist in the list of frame names")

        self.assertEqual(1, ta.drop(frame, frame, frame_name),
                         "drop() should have deleted 1 item")

        # Check that the frame no longer exists
        self.assertFalse(
            frame_name in ta.get_frame_names(),
            frame_name + " should not be in the list of frame names")
示例#12
0
    def test_generic_drop_by_object(self):
        # Create graph
        graph_name = str(uuid.uuid1()).replace('-', '_')
        graph = ta.Graph(name=graph_name)

        # Check that the graph we just created now exists
        self.assertTrue(
            graph_name in ta.get_graph_names(),
            graph_name + " should exist in the list of graph names")

        # drop item using graph object
        self.assertEqual(1, ta.drop(graph),
                         "drop() should have deleted one item")

        # check that the graph no longer exists
        self.assertFalse(graph_name in ta.get_graph_names(),
                         graph_name + " should not exist in the list of graph")
示例#13
0
    def test_generic_drop_with_list(self):
        frame_name1 = str(uuid.uuid1()).replace('-','_')
        frame1 = ta.Frame(name=frame_name1)
        frame_name2 = str(uuid.uuid1()).replace('-','_')
        ta.Frame(name=frame_name2)

        # Create list with frame proxy object and frame name
        frameList = [frame1, frame_name2]

        # Check that the frames we just created now exist
        self.assertTrue(frame_name1 in ta.get_frame_names(), frame_name1 + " should exist in the list of frame names")
        self.assertTrue(frame_name2 in ta.get_frame_names(), frame_name2 + " should exist in the list of frame names")

        self.assertEqual(2, ta.drop(frameList), "drop() should have deleted the 2 items from the list")

        # Check that the frames no longer exist
        self.assertFalse(frame_name1 in ta.get_frame_names(), frame_name1 + " should not be in the list of frame names")
        self.assertFalse(frame_name2 in ta.get_frame_names(), frame_name2 + " should not be in the list of frame names")
示例#14
0
    def test_generic_drop_by_invalid_name(self):
        frame_name = str(uuid.uuid1()).replace('-','_')
        self.assertTrue(frame_name not in ta.get_frame_names(), frame_name + " should not exist in the list of frames")

        # Verify that calling drop on a frame that does not exist does not fail
        self.assertEqual(0, ta.drop(frame_name), "drop() with a non-existent item name should not have deleted items")