'Fields that have been declared on the serializer class must be included
in the `Meta.fields` if it exists.'

def test_missing_field(self):

    class TestSerializer(serializers.ModelSerializer, ):
        missing = serializers.ReadOnlyField()
        class Meta:
            model = RegularFieldsModel
            fields = (u'auto_field',)
    with self.assertRaises(AssertionError) as excinfo:
        TestSerializer().fields
    expected = u"The    field    'missing'    was    declared    on    serializer    TestSerializer,    but    has    not    been    included    in    the    'fields'    option."
    assert (str(excinfo.exception) == expected)
