mirror of https://github.com/doccano/doccano.git
pythondatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learningannotation-tool
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.
26 lines
951 B
26 lines
951 B
from rest_framework.test import APITestCase
|
|
|
|
from ..serializers import ExampleSerializer
|
|
from .api.utils import make_doc, make_example_state, prepare_project
|
|
|
|
|
|
class TestExampleStateSerializer(APITestCase):
|
|
|
|
def setUp(self):
|
|
self.project = prepare_project(task='DocumentClassification')
|
|
self.example = make_doc(self.project.item)
|
|
|
|
def test_in_is_confirmed(self):
|
|
serializer = ExampleSerializer(instance=self.example)
|
|
self.assertIn('is_confirmed', serializer.data)
|
|
|
|
def test_is_not_confirmed(self):
|
|
serializer = ExampleSerializer(instance=self.example)
|
|
is_confirmed = serializer.data['is_confirmed']
|
|
self.assertFalse(is_confirmed)
|
|
|
|
def test_is_confirmed(self):
|
|
make_example_state(self.example, self.project.users[0])
|
|
serializer = ExampleSerializer(instance=self.example)
|
|
is_confirmed = serializer.data['is_confirmed']
|
|
self.assertTrue(is_confirmed)
|