aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_relations.py
diff options
context:
space:
mode:
authorTom Christie2014-08-19 13:28:07 +0100
committerTom Christie2014-08-19 13:28:07 +0100
commitbf09c32de8f9d528f83e9cb7a2773d1f4c9ab563 (patch)
tree334c85c136fe1dc010f8d7860b9431b3a9d87e56 /tests/test_relations.py
parente385a7b8eb6e538698f28128e43fe8bfaefd4e97 (diff)
downloaddjango-rest-framework-bf09c32de8f9d528f83e9cb7a2773d1f4c9ab563.tar.bz2
Code linting and added runtests.py
Diffstat (limited to 'tests/test_relations.py')
-rw-r--r--tests/test_relations.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test_relations.py b/tests/test_relations.py
index cd276d30..bc1db69f 100644
--- a/tests/test_relations.py
+++ b/tests/test_relations.py
@@ -108,19 +108,25 @@ class RelatedFieldSourceTests(TestCase):
doesn't exist.
"""
from tests.models import ManyToManySource
+
class Meta:
model = ManyToManySource
+
attrs = {
'name': serializers.SlugRelatedField(
slug_field='name', source='banzai'),
'Meta': Meta,
}
- TestSerializer = type(str('TestSerializer'),
- (serializers.ModelSerializer,), attrs)
+ TestSerializer = type(
+ str('TestSerializer'),
+ (serializers.ModelSerializer,),
+ attrs
+ )
with self.assertRaises(AttributeError):
TestSerializer(data={'name': 'foo'})
+
@unittest.skipIf(get_version() < '1.6.0', 'Upstream behaviour changed in v1.6')
class RelatedFieldChoicesTests(TestCase):
"""
@@ -141,4 +147,3 @@ class RelatedFieldChoicesTests(TestCase):
widget_count = len(field.widget.choices)
self.assertEqual(widget_count, choice_count + 1, 'BLANK_CHOICE_DASH option should have been added')
-