def test_create_annotation_type(self):
        """Test case for create_annotation_type

        """
        annotation_type = AnnotationType(name="create_annotation_type", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=self.product.id)
        created_annotation_type = self.api.create_annotation_type(body=annotation_type)

        self.api.destroy_annotation_type(id=created_annotation_type.id)
        pass
    def test_destroy_annotation_type(self):
        """Test case for destroy_annotation_type

        """
        annotation_type = AnnotationType(name="destroy_annotation_type", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=self.product.id)
        created_annotation_type = self.api.create_annotation_type(body=annotation_type)

        self.api.destroy_annotation_type(id=created_annotation_type.id)
        annotation_types = self.api.list_annotation_types(id=created_annotation_type.id)
        assert 0 == annotation_types.count
        pass
Ejemplo n.º 3
0
    def setUp(self):
        self.api = AnnotationsApi()  # noqa: E501
        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()
        self.product_api = ProductsApi()
        self.anno_type_api = AnnotationTypesApi()
        self.image_api = ImagesApi()

        # create dummy team, image_sets, product, image and anno_type
        teams = self.team_api.list_teams(name="test_annotation")
        if teams.count == 0:
            team = Team(name="test_annotation")
            team = self.team_api.create_team(body=team) 
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_annotation")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_annotation", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        products = self.product_api.list_products(name="test_annotation")
        if products.count == 0:
            product = Product(name="test_annotation", imagesets=[image_set.id], team=team.id)
            product = self.product_api.create_product(body=product)
        else:
            product = products.results[0]

        annotation_types = self.anno_type_api.list_annotation_types(name="test_annotation")
        if annotation_types.count == 0:
            annotation_type = AnnotationType(name="test_annotation", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=product.id)
            annotation_type = self.anno_type_api.create_annotation_type(body=annotation_type)
        else:
            annotation_type = annotation_types.results[0]

        images = self.image_api.list_images(name="Eosinophile.png")
        if images.count == 0:
            file_path = "exact_sync/v1/test/images/Eosinophile.png"
            image_type = 0
            
            images = self.image_api.create_image(file_path=file_path, image_type=image_type, image_set=image_set.id)
            image = images.results[0]
        else:
            image = images.results[0]

        self.team = team
        self.image_set = image_set 
        self.product = product 
        self.annotation_type = annotation_type
        self.image = image
    def test_partial_update_annotation_type(self):
        """Test case for partial_update_annotation_type

        """
        annotation_type = AnnotationType(name="p_annotation_type", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=self.product.id)
        created_annotation_type = self.api.create_annotation_type(body=annotation_type)

        vector_type = int(AnnotationType.VECTOR_TYPE.FIXED_SIZE_BOUNDING_BOX)
        updated_anno_type = self.api.partial_update_annotation_type(id=created_annotation_type.id, vector_type=vector_type)


        assert vector_type == updated_anno_type.vector_type
        self.api.destroy_annotation_type(id=updated_anno_type.id)
        pass