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

  1. from django.db import IntegrityError
  2. from django.test import TestCase
  3. from model_mommy import mommy
  4. from projects.tests.utils import prepare_project
  5. class TestBoundingBox(TestCase):
  6. @classmethod
  7. def setUpTestData(cls):
  8. cls.project = prepare_project()
  9. cls.example = mommy.make("Example", project=cls.project.item)
  10. cls.user = cls.project.admin
  11. def test_cannot_create_label_if_x_is_less_than_zero(self):
  12. with self.assertRaises(IntegrityError):
  13. mommy.make("BoundingBox", example=self.example, x=-1, y=0, width=0, height=0)
  14. def test_cannot_create_label_if_y_is_less_than_zero(self):
  15. with self.assertRaises(IntegrityError):
  16. mommy.make("BoundingBox", example=self.example, x=0, y=-1, width=0, height=0)
  17. def test_cannot_create_label_if_width_is_less_than_zero(self):
  18. with self.assertRaises(IntegrityError):
  19. mommy.make("BoundingBox", example=self.example, x=0, y=0, width=-1, height=0)
  20. def test_cannot_create_label_if_height_is_less_than_zero(self):
  21. with self.assertRaises(IntegrityError):
  22. mommy.make("BoundingBox", example=self.example, x=0, y=0, width=0, height=-1)