mirror of https://github.com/doccano/doccano.git
pythonannotation-tooldatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learning
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.2 KiB
29 lines
1.2 KiB
from django.db import IntegrityError
|
|
from django.test import TestCase
|
|
from model_mommy import mommy
|
|
|
|
from projects.tests.utils import prepare_project
|
|
|
|
|
|
class TestBoundingBox(TestCase):
|
|
@classmethod
|
|
def setUpTestData(cls):
|
|
cls.project = prepare_project()
|
|
cls.example = mommy.make("Example", project=cls.project.item)
|
|
cls.user = cls.project.admin
|
|
|
|
def test_cannot_create_label_if_x_is_less_than_zero(self):
|
|
with self.assertRaises(IntegrityError):
|
|
mommy.make("BoundingBox", example=self.example, x=-1, y=0, width=0, height=0)
|
|
|
|
def test_cannot_create_label_if_y_is_less_than_zero(self):
|
|
with self.assertRaises(IntegrityError):
|
|
mommy.make("BoundingBox", example=self.example, x=0, y=-1, width=0, height=0)
|
|
|
|
def test_cannot_create_label_if_width_is_less_than_zero(self):
|
|
with self.assertRaises(IntegrityError):
|
|
mommy.make("BoundingBox", example=self.example, x=0, y=0, width=-1, height=0)
|
|
|
|
def test_cannot_create_label_if_height_is_less_than_zero(self):
|
|
with self.assertRaises(IntegrityError):
|
|
mommy.make("BoundingBox", example=self.example, x=0, y=0, width=0, height=-1)
|