Fixed #26342 -- Prevented unpacking when repr a NodeNotFoundError

This commit is contained in:
Jarek Glowacki 2016-03-10 14:09:44 +11:00 committed by Markus Holtermann
parent ddf4af885f
commit 34c56687ae
2 changed files with 13 additions and 1 deletions

View File

@ -53,7 +53,7 @@ class NodeNotFoundError(LookupError):
return self.message
def __repr__(self):
return "NodeNotFoundError(%r)" % self.node
return "NodeNotFoundError(%r)" % (self.node, )
class MigrationSchemaMissing(DatabaseError):

View File

@ -0,0 +1,12 @@
from django.db.migrations.exceptions import NodeNotFoundError
from django.test import SimpleTestCase
class ExceptionTests(SimpleTestCase):
def test_node_not_found_error_repr(self):
node = ('some_app_label', 'some_migration_label')
error_repr = repr(NodeNotFoundError('some message', node))
self.assertEqual(
error_repr,
"NodeNotFoundError(('some_app_label', 'some_migration_label'))"
)