mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.7.x] Corrected grammar in migrations error message.
Backport of 61f56e239f from master
			
			
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							67872bfff1
						
					
				
				
					commit
					35cd0854f9
				
			| @@ -37,9 +37,9 @@ class MigrationGraph(object): | |||||||
|  |  | ||||||
|     def add_dependency(self, migration, child, parent): |     def add_dependency(self, migration, child, parent): | ||||||
|         if child not in self.nodes: |         if child not in self.nodes: | ||||||
|             raise KeyError("Migration %s dependencies references nonexistent child node %r" % (migration, child)) |             raise KeyError("Migration %s dependencies reference nonexistent child node %r" % (migration, child)) | ||||||
|         if parent not in self.nodes: |         if parent not in self.nodes: | ||||||
|             raise KeyError("Migration %s dependencies references nonexistent parent node %r" % (migration, parent)) |             raise KeyError("Migration %s dependencies reference nonexistent parent node %r" % (migration, parent)) | ||||||
|         self.dependencies.setdefault(child, set()).add(parent) |         self.dependencies.setdefault(child, set()).add(parent) | ||||||
|         self.dependents.setdefault(parent, set()).add(child) |         self.dependents.setdefault(parent, set()).add(child) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -174,7 +174,8 @@ class GraphTests(TestCase): | |||||||
|         graph.add_node(("app_b", "0001"), None) |         graph.add_node(("app_b", "0001"), None) | ||||||
|         graph.add_dependency("app_a.0003", ("app_a", "0003"), ("app_a", "0002")) |         graph.add_dependency("app_a.0003", ("app_a", "0003"), ("app_a", "0002")) | ||||||
|         graph.add_dependency("app_a.0002", ("app_a", "0002"), ("app_a", "0001")) |         graph.add_dependency("app_a.0002", ("app_a", "0002"), ("app_a", "0001")) | ||||||
|         with self.assertRaisesMessage(KeyError, "Migration app_a.0001 dependencies references nonexistent parent node ('app_b', '0002')"): |         msg = "Migration app_a.0001 dependencies reference nonexistent parent node ('app_b', '0002')" | ||||||
|  |         with self.assertRaisesMessage(KeyError, msg): | ||||||
|             graph.add_dependency("app_a.0001", ("app_a", "0001"), ("app_b", "0002")) |             graph.add_dependency("app_a.0001", ("app_a", "0001"), ("app_b", "0002")) | ||||||
|  |  | ||||||
|     def test_missing_child_nodes(self): |     def test_missing_child_nodes(self): | ||||||
| @@ -184,5 +185,6 @@ class GraphTests(TestCase): | |||||||
|         # Build graph |         # Build graph | ||||||
|         graph = MigrationGraph() |         graph = MigrationGraph() | ||||||
|         graph.add_node(("app_a", "0001"), None) |         graph.add_node(("app_a", "0001"), None) | ||||||
|         with self.assertRaisesMessage(KeyError, "Migration app_a.0002 dependencies references nonexistent child node ('app_a', '0002')"): |         msg = "Migration app_a.0002 dependencies reference nonexistent child node ('app_a', '0002')" | ||||||
|  |         with self.assertRaisesMessage(KeyError, msg): | ||||||
|             graph.add_dependency("app_a.0002", ("app_a", "0002"), ("app_a", "0001")) |             graph.add_dependency("app_a.0002", ("app_a", "0002"), ("app_a", "0001")) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user