summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJosh Schneier <josh.schneier@gmail.com>2014-12-17 18:41:36 -0500
committerTim Graham <timograham@gmail.com>2014-12-21 16:10:43 -0500
commit9a23470072865b7aa659e6af0b275668c85bb44d (patch)
tree23b05f01699fc591213dcf3cc95dddf57c5202fe /tests
parent653a3a4e18134803bf9cbe8668bcdd678844c995 (diff)
Fixed #24017 -- Added python_2_unicode_compatible in db/migrations
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_graph.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/migrations/test_graph.py b/tests/migrations/test_graph.py
index c5ccdb79db..89ad206897 100644
--- a/tests/migrations/test_graph.py
+++ b/tests/migrations/test_graph.py
@@ -1,5 +1,6 @@
from django.test import TestCase
from django.db.migrations.graph import CircularDependencyError, MigrationGraph, NodeNotFoundError
+from django.utils.encoding import force_text
class GraphTests(TestCase):
@@ -213,7 +214,7 @@ class GraphTests(TestCase):
/ \
app_c: 0001<- <------------- x 0002
- And apply sqashing on app_c.
+ And apply squashing on app_c.
"""
graph = MigrationGraph()
@@ -229,3 +230,18 @@ class GraphTests(TestCase):
with self.assertRaises(CircularDependencyError):
graph.forwards_plan(("app_c", "0001_squashed_0002"))
+
+ def test_stringify(self):
+ graph = MigrationGraph()
+ self.assertEqual(force_text(graph), "Graph: 0 nodes, 0 edges")
+
+ graph.add_node(("app_a", "0001"), None)
+ graph.add_node(("app_a", "0002"), None)
+ graph.add_node(("app_a", "0003"), None)
+ graph.add_node(("app_b", "0001"), None)
+ graph.add_node(("app_b", "0002"), None)
+ graph.add_dependency("app_a.0002", ("app_a", "0002"), ("app_a", "0001"))
+ graph.add_dependency("app_a.0003", ("app_a", "0003"), ("app_a", "0002"))
+ graph.add_dependency("app_a.0003", ("app_a", "0003"), ("app_b", "0002"))
+
+ self.assertEqual(force_text(graph), "Graph: 5 nodes, 3 edges")