Cleanup commit after peer review.
This commit is contained in:
parent
9587d4eea0
commit
01a5359477
2
AUTHORS
2
AUTHORS
|
@ -58,6 +58,7 @@ answer newbie questions, and generally made Django that much better:
|
|||
Gisle Aas <gisle@aas.no>
|
||||
Chris Adams
|
||||
Mathieu Agopian <mathieu.agopian@gmail.com>
|
||||
Roberto Aguilar <roberto@baremetal.io>
|
||||
ajs <adi@sieker.info>
|
||||
alang@bright-green.com
|
||||
A S Alam <aalam@users.sf.net>
|
||||
|
@ -651,7 +652,6 @@ answer newbie questions, and generally made Django that much better:
|
|||
Gasper Zejn <zejn@kiberpipa.org>
|
||||
Jarek Zgoda <jarek.zgoda@gmail.com>
|
||||
Cheng Zhang
|
||||
Roberto Aguilar <roberto@baremetal.io>
|
||||
|
||||
A big THANK YOU goes to:
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ To add your own serializers, use the SERIALIZATION_MODULES setting::
|
|||
"""
|
||||
|
||||
import importlib
|
||||
import sys
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils import six
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
from django.contrib.sites.models import Site
|
||||
|
|
|
@ -451,7 +451,7 @@ class YamlImportModuleMock(object):
|
|||
serializer is being imported. The importlib.import_module() call is
|
||||
being made in the serializers.register_serializer().
|
||||
|
||||
#12756
|
||||
Refs: #12756
|
||||
"""
|
||||
def __init__(self):
|
||||
self._import_module = importlib.import_module
|
||||
|
@ -466,7 +466,7 @@ class YamlImportModuleMock(object):
|
|||
class NoYamlSerializerTestCase(TestCase):
|
||||
"""Not having pyyaml installed provides a misleading error
|
||||
|
||||
#12756
|
||||
Refs: #12756
|
||||
"""
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
@ -489,7 +489,7 @@ class NoYamlSerializerTestCase(TestCase):
|
|||
# clear out cached serializers to clean out BadSerializer instances
|
||||
serializers._serializers = {}
|
||||
|
||||
def test_missing_pyyaml_error_message(self):
|
||||
def test_serializer_pyyaml_error_message(self):
|
||||
"""Using yaml serializer without pyyaml raises ImportError"""
|
||||
jane = Author(name="Jane")
|
||||
self.assertRaises(ImportError, serializers.serialize, "yaml", [jane])
|
||||
|
@ -498,7 +498,8 @@ class NoYamlSerializerTestCase(TestCase):
|
|||
"""Using yaml deserializer without pyyaml raises ImportError"""
|
||||
self.assertRaises(ImportError, serializers.deserialize, "yaml", "")
|
||||
|
||||
def test_missing_pyyaml_error_message(self):
|
||||
def test_dumpdata_pyyaml_error_message(self):
|
||||
"""Calling dumpdata produces an error when yaml package missing"""
|
||||
self.assertRaisesRegexp(management.CommandError, YAML_IMPORT_ERROR_MESSAGE,
|
||||
management.call_command, 'dumpdata', format='yaml')
|
||||
|
||||
|
|
|
@ -523,7 +523,10 @@ def streamTest(format, self):
|
|||
else:
|
||||
self.assertEqual(string_data, stream.content.decode('utf-8'))
|
||||
|
||||
for format in filter(lambda x: not isinstance(serializers.get_serializer(x), serializers.BadSerializer), serializers.get_serializer_formats()):
|
||||
for format in [
|
||||
f for f in serializers.get_serializer_formats()
|
||||
if not isinstance(serializers.get_serializer(f), serializers.BadSerializer)
|
||||
]:
|
||||
setattr(SerializerTests, 'test_' + format + '_serializer', curry(serializerTest, format))
|
||||
setattr(SerializerTests, 'test_' + format + '_natural_key_serializer', curry(naturalKeySerializerTest, format))
|
||||
setattr(SerializerTests, 'test_' + format + '_serializer_fields', curry(fieldsTest, format))
|
||||
|
|
Loading…
Reference in New Issue