PageRenderTime 122ms CodeModel.GetById 60ms app.highlight 2ms RepoModel.GetById 59ms app.codeStats 0ms

/django/contrib/admindocs/tests/__init__.py

https://code.google.com/p/mango-py/
Python | 31 lines | 25 code | 6 blank | 0 comment | 0 complexity | 30963fb69a3fbf238afd46a954d5a30d MD5 | raw file
 1from django.contrib.admindocs import views
 2from django.db.models import fields as builtin_fields
 3from django.utils import unittest
 4
 5import fields
 6
 7
 8class TestFieldType(unittest.TestCase):
 9    def setUp(self):
10        pass
11
12    def test_field_name(self):
13        self.assertRaises(AttributeError,
14            views.get_readable_field_data_type, "NotAField"
15        )
16
17    def test_builtin_fields(self):
18        self.assertEqual(
19            views.get_readable_field_data_type(builtin_fields.BooleanField()),
20            u'Boolean (Either True or False)'
21        )
22
23    def test_custom_fields(self):
24        self.assertEqual(
25            views.get_readable_field_data_type(fields.CustomField()),
26            u'A custom field type'
27        )
28        self.assertEqual(
29            views.get_readable_field_data_type(fields.DescriptionLackingField()),
30            u'Field of type: DescriptionLackingField'
31        )