Add test to check flatchoices

This commit is contained in:
Drew Hubl 2016-09-23 04:53:51 -06:00
parent ffcb337744
commit 59b83db9f8

View file

@ -23,7 +23,7 @@ from django.test import TestCase
from multiselectfield.utils import get_max_length
from .models import Book
from .models import Book, PROVINCES, STATES
if sys.version_info < (3,):
@ -127,6 +127,11 @@ class MultiSelectTestCase(TestCase):
self.assertEqual(get_field(Book, 'tags').value_to_string(book), 'sex,work,happy')
self.assertEqual(get_field(Book, 'categories').value_to_string(book), '1,3,5')
def test_flatchoices(self):
#raise Exception(Book._meta.get_field('published_in').flatchoices)
# raise Exception(Book.published_in.flatchoices)
self.assertEqual(get_field(Book, 'published_in').flatchoices, list(PROVINCES+STATES))
class MultiSelectUtilsTestCase(TestCase):
def test_get_max_length_max_length_is_not_none(self):