diff options
| author | Tom Christie | 2014-12-15 09:13:02 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-15 09:13:02 +0000 |
| commit | 5e7c9687c7e11b6adfe2fc534eb0504e67ca9fc9 (patch) | |
| tree | 8a6132031a0535e86efcbef5669ee4bb17825fc2 /tests/test_serializer.py | |
| parent | a72f812d80a4000e86a5ad96001f3fbf43fe310a (diff) | |
| download | django-rest-framework-5e7c9687c7e11b6adfe2fc534eb0504e67ca9fc9.tar.bz2 | |
First pass at serializer repr bug
Diffstat (limited to 'tests/test_serializer.py')
| -rw-r--r-- | tests/test_serializer.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_serializer.py b/tests/test_serializer.py index 56b39095..48fcc83b 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -1,3 +1,4 @@ +# coding: utf-8 from __future__ import unicode_literals from rest_framework import serializers import pytest @@ -197,3 +198,19 @@ class TestIncorrectlyConfigured: "The serializer field might be named incorrectly and not match any attribute or key on the `ExampleObject` instance.\n" "Original exception text was:" ) + + +class TestUnicodeRepr: + def test_unicode_repr(self): + class ExampleSerializer(serializers.Serializer): + example = serializers.CharField() + + class ExampleObject: + def __init__(self): + self.example = '한국' + def __repr__(self): + return self.example.encode('utf8') + + instance = ExampleObject() + serializer = ExampleSerializer(instance) + repr(serializer) |
