summaryrefslogtreecommitdiff
path: root/tests/multiple_database
diff options
context:
space:
mode:
authorJason Myers <jason@jasonamyers.com>2013-11-02 16:34:05 -0500
committerJason Myers <jason@jasonamyers.com>2013-11-02 23:48:47 -0500
commitc3791463a5a9674f8e0148fbab57eae23c138896 (patch)
tree6606acdb74132a344a49e910dec5d0356389a569 /tests/multiple_database
parent2a03a9a9a1c4517be75e72899e545b0bc9dd0688 (diff)
Fixing E302 Errors
Signed-off-by: Jason Myers <jason@jasonamyers.com>
Diffstat (limited to 'tests/multiple_database')
-rw-r--r--tests/multiple_database/tests.py36
1 files changed, 21 insertions, 15 deletions
diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py
index f7c5862167..046b8fb14b 100644
--- a/tests/multiple_database/tests.py
+++ b/tests/multiple_database/tests.py
@@ -50,7 +50,8 @@ class QueryTestCase(TestCase):
except Book.DoesNotExist:
self.fail('"Pro Django" should exist on default database')
- self.assertRaises(Book.DoesNotExist,
+ self.assertRaises(
+ Book.DoesNotExist,
Book.objects.using('other').get,
title="Pro Django"
)
@@ -61,7 +62,8 @@ class QueryTestCase(TestCase):
except Book.DoesNotExist:
self.fail('"Dive into Python" should exist on default database')
- self.assertRaises(Book.DoesNotExist,
+ self.assertRaises(
+ Book.DoesNotExist,
Book.objects.using('other').get,
title="Dive into Python"
)
@@ -84,11 +86,13 @@ class QueryTestCase(TestCase):
except Book.DoesNotExist:
self.fail('"Pro Django" should exist on other database')
- self.assertRaises(Book.DoesNotExist,
+ self.assertRaises(
+ Book.DoesNotExist,
Book.objects.get,
title="Pro Django"
)
- self.assertRaises(Book.DoesNotExist,
+ self.assertRaises(
+ Book.DoesNotExist,
Book.objects.using('default').get,
title="Pro Django"
)
@@ -98,11 +102,13 @@ class QueryTestCase(TestCase):
except Book.DoesNotExist:
self.fail('"Dive into Python" should exist on other database')
- self.assertRaises(Book.DoesNotExist,
+ self.assertRaises(
+ Book.DoesNotExist,
Book.objects.get,
title="Dive into Python"
)
- self.assertRaises(Book.DoesNotExist,
+ self.assertRaises(
+ Book.DoesNotExist,
Book.objects.using('default').get,
title="Dive into Python"
)
@@ -164,14 +170,14 @@ class QueryTestCase(TestCase):
# Check that queries work across m2m joins
self.assertEqual(list(Book.objects.using('default').filter(authors__name='Marty Alchin').values_list('title', flat=True)),
- ['Pro Django'])
+ ['Pro Django'])
self.assertEqual(list(Book.objects.using('other').filter(authors__name='Marty Alchin').values_list('title', flat=True)),
- [])
+ [])
self.assertEqual(list(Book.objects.using('default').filter(authors__name='Mark Pilgrim').values_list('title', flat=True)),
- [])
+ [])
self.assertEqual(list(Book.objects.using('other').filter(authors__name='Mark Pilgrim').values_list('title', flat=True)),
- ['Dive into Python'])
+ ['Dive into Python'])
# Reget the objects to clear caches
dive = Book.objects.using('other').get(title="Dive into Python")
@@ -179,10 +185,10 @@ class QueryTestCase(TestCase):
# Retrive related object by descriptor. Related objects should be database-baound
self.assertEqual(list(dive.authors.all().values_list('name', flat=True)),
- ['Mark Pilgrim'])
+ ['Mark Pilgrim'])
self.assertEqual(list(mark.book_set.all().values_list('title', flat=True)),
- ['Dive into Python'])
+ ['Dive into Python'])
def test_m2m_forward_operations(self):
"M2M forward manipulations are all constrained to a single DB"
@@ -198,13 +204,13 @@ class QueryTestCase(TestCase):
# Add a second author
john = Person.objects.using('other').create(name="John Smith")
self.assertEqual(list(Book.objects.using('other').filter(authors__name='John Smith').values_list('title', flat=True)),
- [])
+ [])
dive.authors.add(john)
self.assertEqual(list(Book.objects.using('other').filter(authors__name='Mark Pilgrim').values_list('title', flat=True)),
- ['Dive into Python'])
+ ['Dive into Python'])
self.assertEqual(list(Book.objects.using('other').filter(authors__name='John Smith').values_list('title', flat=True)),
- ['Dive into Python'])
+ ['Dive into Python'])
# Remove the second author
dive.authors.remove(john)