diff options
Diffstat (limited to 'tests/test_relations.py')
| -rw-r--r-- | tests/test_relations.py | 11 | 
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') - | 
