mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-10 19:16:34 +03:00
Added test for sql percents treatment
This commit is contained in:
parent
828415d476
commit
41b9bfe401
|
@ -60,6 +60,15 @@ class ComposeTests(ConnectingTestCase):
|
|||
s1 = s.as_string(self.conn)
|
||||
self.assertEqual(s1, "select foo;")
|
||||
|
||||
def test_percent_escape(self):
|
||||
s = sql.compose("42 %% %s", [sql.Literal(7)])
|
||||
s1 = s.as_string(self.conn)
|
||||
self.assertEqual(s1, "42 % 7")
|
||||
|
||||
s = sql.compose("42 %% 7")
|
||||
s1 = s.as_string(self.conn)
|
||||
self.assertEqual(s1, "42 % 7")
|
||||
|
||||
def test_compose_badnargs(self):
|
||||
self.assertRaises(ValueError, sql.compose, "select foo;", [10])
|
||||
self.assertRaises(ValueError, sql.compose, "select %s;")
|
||||
|
|
Loading…
Reference in New Issue
Block a user