Fixed sql.Composed representation

This commit is contained in:
Daniele Varrazzo 2017-01-01 06:25:53 +01:00
parent 600416aafc
commit 8c020ca47a
2 changed files with 7 additions and 1 deletions

View File

@ -54,7 +54,7 @@ class Composed(Composible):
self._seq.append(i) self._seq.append(i)
def __repr__(self): def __repr__(self):
return "sql.Composed(%r)" % (self.seq,) return "sql.Composed(%r)" % (self._seq,)
def as_string(self, conn_or_curs): def as_string(self, conn_or_curs):
rv = [] rv = []

View File

@ -189,6 +189,12 @@ class ComposedTest(ConnectingTestCase):
def test_class(self): def test_class(self):
self.assert_(issubclass(sql.Composed, sql.Composible)) self.assert_(issubclass(sql.Composed, sql.Composible))
def test_repr(self):
obj = sql.Composed([sql.Literal("foo"), sql.Identifier("b'ar")])
self.assertEqual(repr(obj),
"""sql.Composed([sql.Literal('foo'), sql.Identifier("b'ar")])""")
self.assertEqual(str(obj), repr(obj))
def test_join(self): def test_join(self):
obj = sql.Composed([sql.Literal("foo"), sql.Identifier("b'ar")]) obj = sql.Composed([sql.Literal("foo"), sql.Identifier("b'ar")])
obj = obj.join(", ") obj = obj.join(", ")