mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 19:43:59 +03:00
971578ca34
* Get rid of runtests.py * Moved test code from rest_framework/tests and rest_framework/runtests to tests * Invoke py.test from setup.py * Invoke py.test from Travis * Invoke py.test from tox * Changed setUpClass to be just plain setUp in test_permissions.py * Updated contribution guideline to show how to invoke py.test
16 lines
478 B
Python
16 lines
478 B
Python
from django.test import TestCase
|
|
from rest_framework import serializers
|
|
|
|
|
|
class EmptySerializerTestCase(TestCase):
|
|
def test_empty_serializer(self):
|
|
class FooBarSerializer(serializers.Serializer):
|
|
foo = serializers.IntegerField()
|
|
bar = serializers.SerializerMethodField('get_bar')
|
|
|
|
def get_bar(self, obj):
|
|
return 'bar'
|
|
|
|
serializer = FooBarSerializer()
|
|
self.assertEquals(serializer.data, {'foo': 0})
|