Browse Source

Add a test case of auto labeling for nonexistent category

pull/1996/head
Hironsan 2 years ago
parent
commit
2505de0f8c
1 changed files with 6 additions and 0 deletions
  1. 6
      backend/auto_labeling/tests/test_views.py

6
backend/auto_labeling/tests/test_views.py

@ -164,6 +164,12 @@ class TestAutomatedLabeling(CRUDMixin):
self.assertEqual(Category.objects.count(), 1)
self.assertEqual(Category.objects.first().label, self.category_pos)
@patch("auto_labeling.views.execute_pipeline", return_value=Categories([{"label": "NEUTRAL"}]))
def test_nonexistent_category(self, mock):
mommy.make("AutoLabelingConfig", task_type="Category", project=self.project.item)
self.assert_create(self.project.admin, status.HTTP_201_CREATED)
self.assertEqual(Category.objects.count(), 0)
@patch(
"auto_labeling.views.execute_pipeline",
side_effect=[Categories([{"label": "POS"}]), Categories([{"label": "NEG"}])],

Loading…
Cancel
Save