summaryrefslogtreecommitdiff
path: root/tests/migrations/test_graph.py
diff options
context:
space:
mode:
authorHasan <hasan.r67@gmail.com>2016-01-17 14:56:39 +0330
committerTim Graham <timograham@gmail.com>2016-01-29 12:32:18 -0500
commit3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5 (patch)
tree0d1074cc65a72096e44a4165611fddfc5b7ef7fb /tests/migrations/test_graph.py
parent575706331bec4bf58ce36a9540c4c61fca49025b (diff)
downloaddjango-3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5.tar.gz
Refs #26022 -- Used context manager version of assertRaises in tests.
Diffstat (limited to 'tests/migrations/test_graph.py')
-rw-r--r--tests/migrations/test_graph.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/migrations/test_graph.py b/tests/migrations/test_graph.py
index 6260d41887..50cefdf158 100644
--- a/tests/migrations/test_graph.py
+++ b/tests/migrations/test_graph.py
@@ -145,10 +145,8 @@ class GraphTests(SimpleTestCase):
graph.add_dependency("app_b.0002", ("app_b", "0002"), ("app_b", "0001"))
graph.add_dependency("app_b.0001", ("app_b", "0001"), ("app_a", "0003"))
# Test whole graph
- self.assertRaises(
- CircularDependencyError,
- graph.forwards_plan, ("app_a", "0003"),
- )
+ with self.assertRaises(CircularDependencyError):
+ graph.forwards_plan(("app_a", "0003"), )
def test_circular_graph_2(self):
graph = MigrationGraph()
@@ -159,10 +157,8 @@ class GraphTests(SimpleTestCase):
graph.add_dependency('B.0001', ('B', '0001'), ('A', '0001'))
graph.add_dependency('C.0001', ('C', '0001'), ('B', '0001'))
- self.assertRaises(
- CircularDependencyError,
- graph.forwards_plan, ('C', '0001')
- )
+ with self.assertRaises(CircularDependencyError):
+ graph.forwards_plan(('C', '0001'))
def test_graph_recursive(self):
graph = MigrationGraph()