Browse Source

Add a test case for generating color function

pull/1564/head
Hironsan 3 years ago
parent
commit
4a2f680c3f
1 changed files with 10 additions and 1 deletions
  1. 11
      backend/api/tests/test_models.py

11
backend/api/tests/test_models.py

@ -3,7 +3,8 @@ from django.db.utils import IntegrityError
from django.test import TestCase, override_settings
from model_mommy import mommy
from ..models import Category, Label, Span, TextLabel
from ..models import (Category, Label, Span, TextLabel,
generate_random_hex_color)
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.StaticFilesStorage')
@ -141,3 +142,11 @@ class TestSeq2seqAnnotation(TestCase):
TextLabel(example=a.example,
user=a.user,
text=a.text).save()
class TestGeneratedColor(TestCase):
def test_length(self):
for i in range(100):
color = generate_random_hex_color()
self.assertEqual(len(color), 7)
Loading…
Cancel
Save