summaryrefslogtreecommitdiff
path: root/tests/fixtures_regress
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-04 08:08:27 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit7119f40c9881666b6f9b5cf7df09ee1d21cc8344 (patch)
treefa50869f5614295f462d9bf77fec59365c621609 /tests/fixtures_regress
parent9c19aff7c7561e3a82978a272ecdaad40dda5c00 (diff)
downloaddjango-7119f40c9881666b6f9b5cf7df09ee1d21cc8344.tar.gz
Refs #33476 -- Refactored code to strictly match 88 characters line length.
Diffstat (limited to 'tests/fixtures_regress')
-rw-r--r--tests/fixtures_regress/tests.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
index 318c9a3a14..61dd12754c 100644
--- a/tests/fixtures_regress/tests.py
+++ b/tests/fixtures_regress/tests.py
@@ -209,7 +209,10 @@ class TestFixtures(TestCase):
Test for ticket #4371 -- Loading data of an unknown format should fail
Validate that error conditions are caught correctly
"""
- msg = "Problem installing fixture 'bad_fix.ture1': unkn is not a known serialization format."
+ msg = (
+ "Problem installing fixture 'bad_fix.ture1': unkn is not a known "
+ "serialization format."
+ )
with self.assertRaisesMessage(management.CommandError, msg):
management.call_command(
"loaddata",
@@ -438,14 +441,14 @@ class TestFixtures(TestCase):
)
self.assertJSONEqual(
out.getvalue(),
- """[{"pk": %d, "model": "fixtures_regress.widget", "fields": {"name": "grommet"}}]"""
- % widget.pk,
+ '[{"pk": %d, "model": "fixtures_regress.widget", '
+ '"fields": {"name": "grommet"}}]' % widget.pk,
)
@skipUnlessDBFeature("supports_forward_references")
def test_loaddata_works_when_fixture_has_forward_refs(self):
"""
- Regression for #3615 - Forward references cause fixtures not to load in MySQL (InnoDB)
+ Forward references cause fixtures not to load in MySQL (InnoDB).
"""
management.call_command(
"loaddata",
@@ -457,7 +460,7 @@ class TestFixtures(TestCase):
def test_loaddata_raises_error_when_fixture_has_invalid_foreign_key(self):
"""
- Regression for #3615 - Ensure data with nonexistent child key references raises error
+ Data with nonexistent child key references raises error.
"""
with self.assertRaisesMessage(IntegrityError, "Problem installing fixture"):
management.call_command(
@@ -489,9 +492,13 @@ class TestFixtures(TestCase):
def test_loaddata_no_fixture_specified(self):
"""
- Regression for #7043 - Error is quickly reported when no fixtures is provided in the command line.
+ Error is quickly reported when no fixtures is provided in the command
+ line.
"""
- msg = "No database fixture specified. Please provide the path of at least one fixture in the command line."
+ msg = (
+ "No database fixture specified. Please provide the path of at least one "
+ "fixture in the command line."
+ )
with self.assertRaisesMessage(management.CommandError, msg):
management.call_command(
"loaddata",
@@ -648,10 +655,13 @@ class NaturalKeyFixtureTests(TestCase):
self.assertJSONEqual(
out.getvalue(),
"""
- [{"fields": {"main": null, "name": "Amazon"}, "model": "fixtures_regress.store"},
- {"fields": {"main": null, "name": "Borders"}, "model": "fixtures_regress.store"},
+ [{"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"]],
+ {"pk": 1, "model": "fixtures_regress.book",
+ "fields": {"stores": [["Amazon"], ["Borders"]],
"name": "Cryptonomicon", "author": ["Neal Stephenson"]}}]
""",
)
@@ -770,9 +780,12 @@ class NaturalKeyFixtureTests(TestCase):
self.assertQuerysetEqual(
books,
[
- "<Book: Cryptonomicon by Neal Stephenson (available at Amazon, Borders)>",
- "<Book: Ender's Game by Orson Scott Card (available at Collins Bookstore)>",
- "<Book: Permutation City by Greg Egan (available at Angus and Robertson)>",
+ "<Book: Cryptonomicon by Neal Stephenson (available at Amazon, "
+ "Borders)>",
+ "<Book: Ender's Game by Orson Scott Card (available at Collins "
+ "Bookstore)>",
+ "<Book: Permutation City by Greg Egan (available at Angus and "
+ "Robertson)>",
],
transform=repr,
)