From 01a5359477fbc82488dddf9476581fe72c049b51 Mon Sep 17 00:00:00 2001 From: Roberto Aguilar Date: Fri, 6 Sep 2013 22:36:05 +0000 Subject: [PATCH] Cleanup commit after peer review. --- AUTHORS | 2 +- django/core/serializers/__init__.py | 1 - tests/fixtures/tests.py | 1 - tests/serializers/tests.py | 9 +++++---- tests/serializers_regress/tests.py | 5 ++++- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 2735f71e7b..75db300513 100644 --- a/AUTHORS +++ b/AUTHORS @@ -58,6 +58,7 @@ answer newbie questions, and generally made Django that much better: Gisle Aas Chris Adams Mathieu Agopian + Roberto Aguilar ajs alang@bright-green.com A S Alam @@ -651,7 +652,6 @@ answer newbie questions, and generally made Django that much better: Gasper Zejn Jarek Zgoda Cheng Zhang - Roberto Aguilar A big THANK YOU goes to: diff --git a/django/core/serializers/__init__.py b/django/core/serializers/__init__.py index 4c9b5ba37a..89d9877ebf 100644 --- a/django/core/serializers/__init__.py +++ b/django/core/serializers/__init__.py @@ -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 diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py index d6348e82ff..c24e0806fa 100644 --- a/tests/fixtures/tests.py +++ b/tests/fixtures/tests.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import unittest import warnings from django.contrib.sites.models import Site diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py index 5ed6e7f9cb..9af8165314 100644 --- a/tests/serializers/tests.py +++ b/tests/serializers/tests.py @@ -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') diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index 0a8267a33b..bd71d4da6a 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -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))