Skip to content

Commit

Permalink
Merge pull request #2132 from doccano/enhancement/packages
Browse files Browse the repository at this point in the history
[Enhancement] Update dependencies
  • Loading branch information
Hironsan committed Feb 16, 2023
2 parents 1055139 + 91d0c5b commit 1b5630c
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 913 deletions.
3 changes: 2 additions & 1 deletion backend/examples/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def test_user_count_after_multiple_user_confirmation(self):
expected_progress = [{"user": member.username, "done": 0} for member in self.project.members]
expected_progress[0]["done"] = 1
expected_progress[1]["done"] = 1
self.assertEqual(progress, {"total": 2, "progress": expected_progress})
self.assertEqual(progress["total"], 2)
self.assertCountEqual(progress["progress"], expected_progress)


class TestExample(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion backend/examples/views/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ExampleList(generics.ListCreateAPIView):
ordering_fields = ("created_at", "updated_at", "score")
search_fields = ("text", "filename")
model = Example
filter_class = ExampleFilter
filterset_class = ExampleFilter

@property
def project(self):
Expand Down
4 changes: 2 additions & 2 deletions backend/label_types/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from model_mommy import mommy

from projects.models import BOUNDING_BOX
from projects.models import BOUNDING_BOX, SEGMENTATION


def make_label(project, **kwargs):
if project.project_type.endswith("Classification") or project.project_type == BOUNDING_BOX:
if project.project_type.endswith("Classification") or project.project_type in {BOUNDING_BOX, SEGMENTATION}:
return mommy.make("CategoryType", project=project, **kwargs)
else:
return mommy.make("SpanType", project=project, **kwargs)
7 changes: 3 additions & 4 deletions backend/labels/tests/test_span.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import abc

from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.test import TestCase
from model_mommy import mommy

Expand Down Expand Up @@ -142,15 +141,15 @@ def setUp(self):
self.user = self.project.admin

def test_start_offset_is_not_negative(self):
with self.assertRaises(IntegrityError):
with self.assertRaises(ValidationError):
mommy.make("Span", start_offset=-1, end_offset=0)

def test_end_offset_is_not_negative(self):
with self.assertRaises(IntegrityError):
with self.assertRaises(ValidationError):
mommy.make("Span", start_offset=-2, end_offset=-1)

def test_start_offset_is_less_than_end_offset(self):
with self.assertRaises(IntegrityError):
with self.assertRaises(ValidationError):
mommy.make("Span", start_offset=0, end_offset=0)

def test_unique_constraint(self):
Expand Down

0 comments on commit 1b5630c

Please sign in to comment.