diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index 3173f73985..0a8267a33b 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -523,7 +523,7 @@ def streamTest(format, self): else: self.assertEqual(string_data, stream.content.decode('utf-8')) -for format in serializers.get_serializer_formats(): +for format in filter(lambda x: not isinstance(serializers.get_serializer(x), serializers.BadSerializer), serializers.get_serializer_formats()): 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)) diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py index 49169f90f2..9390eb93df 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -599,7 +599,7 @@ class SerializationTests(TestCase): obj = next(serializers.deserialize('xml', data)).object self.assertEqual(obj.dt, dt) - if 'yaml' in serializers.get_serializer_formats(): + if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer): data = serializers.serialize('yaml', [Event(dt=dt)]) self.assert_yaml_contains_datetime(data, "2011-09-01 13:20:30") obj = next(serializers.deserialize('yaml', data)).object @@ -623,7 +623,7 @@ class SerializationTests(TestCase): obj = next(serializers.deserialize('xml', data)).object self.assertEqual(obj.dt, dt) - if 'yaml' in serializers.get_serializer_formats(): + if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer): data = serializers.serialize('yaml', [Event(dt=dt)]) self.assert_yaml_contains_datetime(data, "2011-09-01 13:20:30.405060") obj = next(serializers.deserialize('yaml', data)).object @@ -647,7 +647,7 @@ class SerializationTests(TestCase): obj = next(serializers.deserialize('xml', data)).object self.assertEqual(obj.dt, dt) - if 'yaml' in serializers.get_serializer_formats(): + if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer): data = serializers.serialize('yaml', [Event(dt=dt)]) self.assert_yaml_contains_datetime(data, "2011-09-01 17:20:30.405060+07:00") obj = next(serializers.deserialize('yaml', data)).object @@ -671,7 +671,7 @@ class SerializationTests(TestCase): obj = next(serializers.deserialize('xml', data)).object self.assertEqual(obj.dt, dt) - if 'yaml' in serializers.get_serializer_formats(): + if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer): data = serializers.serialize('yaml', [Event(dt=dt)]) self.assert_yaml_contains_datetime(data, "2011-09-01 10:20:30+00:00") obj = next(serializers.deserialize('yaml', data)).object @@ -695,7 +695,7 @@ class SerializationTests(TestCase): obj = next(serializers.deserialize('xml', data)).object self.assertEqual(obj.dt, dt) - if 'yaml' in serializers.get_serializer_formats(): + if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer): data = serializers.serialize('yaml', [Event(dt=dt)]) self.assert_yaml_contains_datetime(data, "2011-09-01 13:20:30+03:00") obj = next(serializers.deserialize('yaml', data)).object @@ -719,7 +719,7 @@ class SerializationTests(TestCase): obj = next(serializers.deserialize('xml', data)).object self.assertEqual(obj.dt, dt) - if 'yaml' in serializers.get_serializer_formats(): + if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer): data = serializers.serialize('yaml', [Event(dt=dt)]) self.assert_yaml_contains_datetime(data, "2011-09-01 17:20:30+07:00") obj = next(serializers.deserialize('yaml', data)).object