summaryrefslogtreecommitdiff
path: root/tests/fixtures_regress
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@gmail.com>2014-10-22 00:15:10 +0700
committerLoic Bistuer <loic.bistuer@gmail.com>2014-10-22 09:25:50 +0700
commit494ba051bb0d3ebbdbea7598251b1ee6fe9b69b4 (patch)
tree47c302bf0d5b9429efea854add58707ff0e54f25 /tests/fixtures_regress
parent533532302ae842c95cf7294ef6cd7f3e2bfaca65 (diff)
downloaddjango-494ba051bb0d3ebbdbea7598251b1ee6fe9b69b4.tar.gz
Made testing of stdout and stderr more consistent.
Refs #23663.
Diffstat (limited to 'tests/fixtures_regress')
-rw-r--r--tests/fixtures_regress/tests.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
index 62b1dca3a0..c5dfe3b3d4 100644
--- a/tests/fixtures_regress/tests.py
+++ b/tests/fixtures_regress/tests.py
@@ -60,7 +60,7 @@ class TestFixtures(TestCase):
name='Platypus',
latin_name='Ornithorhynchus anatinus',
count=2,
- weight=2.2
+ weight=2.2,
)
animal.save()
self.assertGreater(animal.id, 1)
@@ -75,7 +75,7 @@ class TestFixtures(TestCase):
management.call_command(
'loaddata',
'sequence_extra',
- verbosity=0
+ verbosity=0,
)
def test_loaddata_not_found_fields_ignore(self):
@@ -359,20 +359,20 @@ class TestFixtures(TestCase):
name='Platypus',
latin_name='Ornithorhynchus anatinus',
count=2,
- weight=2.2
+ weight=2.2,
)
animal.save()
- stdout = StringIO()
+ out = StringIO()
management.call_command(
'dumpdata',
'fixtures_regress.animal',
format='json',
- stdout=stdout
+ stdout=out,
)
# Output order isn't guaranteed, so check for parts
- data = stdout.getvalue()
+ data = out.getvalue()
# Get rid of artifacts like '000000002' to eliminate the differences
# between different Python versions.
@@ -393,7 +393,7 @@ class TestFixtures(TestCase):
"""
Regression for #11428 - Proxy models aren't included when you dumpdata
"""
- stdout = StringIO()
+ out = StringIO()
# Create an instance of the concrete class
widget = Widget.objects.create(name='grommet')
management.call_command(
@@ -401,10 +401,10 @@ class TestFixtures(TestCase):
'fixtures_regress.widget',
'fixtures_regress.widgetproxy',
format='json',
- stdout=stdout
+ stdout=out,
)
self.assertJSONEqual(
- stdout.getvalue(),
+ out.getvalue(),
"""[{"pk": %d, "model": "fixtures_regress.widget", "fields": {"name": "grommet"}}]"""
% widget.pk
)
@@ -554,7 +554,7 @@ class NaturalKeyFixtureTests(TestCase):
verbosity=0,
)
- stdout = StringIO()
+ out = StringIO()
management.call_command(
'dumpdata',
'fixtures_regress.book',
@@ -564,10 +564,10 @@ class NaturalKeyFixtureTests(TestCase):
format='json',
use_natural_foreign_keys=True,
use_natural_primary_keys=True,
- stdout=stdout,
+ stdout=out,
)
self.assertJSONEqual(
- stdout.getvalue(),
+ out.getvalue(),
"""[{"fields": {"main": null, "name": "Amazon"}, "model": "fixtures_regress.store"}, {"fields": {"main": null, "name": "Borders"}, "model": "fixtures_regress.store"}, {"fields": {"name": "Neal Stephenson"}, "model": "fixtures_regress.person"}, {"pk": 1, "model": "fixtures_regress.book", "fields": {"stores": [["Amazon"], ["Borders"]], "name": "Cryptonomicon", "author": ["Neal Stephenson"]}}]"""
)
@@ -800,19 +800,19 @@ class M2MNaturalKeyFixtureTests(TestCase):
a.b_set.add(b1)
a.b_set.add(b2)
- stdout = StringIO()
+ out = StringIO()
management.call_command(
'dumpdata',
'fixtures_regress.M2MSimpleA',
'fixtures_regress.M2MSimpleB',
use_natural_foreign_keys=True,
- stdout=stdout
+ stdout=out,
)
for model in [M2MSimpleA, M2MSimpleB]:
model.objects.all().delete()
- objects = serializers.deserialize("json", stdout.getvalue())
+ objects = serializers.deserialize("json", out.getvalue())
for obj in objects:
obj.save()