Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
python2 compat
  • Loading branch information
sheppard committed May 28, 2015
commit 0b8b288be597bd4d93d30c74f7c017a9d8abf497
7 changes: 7 additions & 0 deletions tests/test_model_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ class Meta:
class Meta:
validators = [<UniqueTogetherValidator(queryset=UniqueTogetherModel.objects.all(), fields=('foreign_key', 'one_to_one'))>]
""")
if six.PY2:
# This case is also too awkward to resolve fully across both py2
# and py3. (See above)
expected = expected.replace(
"('foreign_key', 'one_to_one')",
"(u'foreign_key', u'one_to_one')"
)
self.assertEqual(unicode_repr(TestSerializer()), expected)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll likely want a slightly different representation for python 2.7.
See https://github.com/sheppard/django-rest-framework/blob/read-only-nested/tests/test_model_serializer.py#L172 for example.


def test_pk_reverse_foreign_key(self):
Expand Down