mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
Flake8 complaints
This commit is contained in:
parent
ef9f9f5fff
commit
3c124a0b87
|
@ -518,29 +518,25 @@ class CursorTests(ConnectingTestCase):
|
||||||
RETURNS INT AS
|
RETURNS INT AS
|
||||||
'SELECT $1 * $1'
|
'SELECT $1 * $1'
|
||||||
LANGUAGE SQL
|
LANGUAGE SQL
|
||||||
''' % (procname, escaped_paramname));
|
''' % (procname, escaped_paramname))
|
||||||
|
|
||||||
# Make sure callproc works right
|
# Make sure callproc works right
|
||||||
cur.callproc(procname, { paramname: 2 })
|
cur.callproc(procname, {paramname: 2})
|
||||||
self.assertEquals(cur.fetchone()[0], 4)
|
self.assertEquals(cur.fetchone()[0], 4)
|
||||||
|
|
||||||
# Make sure callproc fails right
|
# Make sure callproc fails right
|
||||||
failing_cases = [
|
failing_cases = [
|
||||||
({ paramname: 2, 'foo': 'bar' }, psycopg2.ProgrammingError),
|
({paramname: 2, 'foo': 'bar'}, psycopg2.ProgrammingError),
|
||||||
({ paramname: '2' }, psycopg2.ProgrammingError),
|
({paramname: '2'}, psycopg2.ProgrammingError),
|
||||||
({ paramname: 'two' }, psycopg2.ProgrammingError),
|
({paramname: 'two'}, psycopg2.ProgrammingError),
|
||||||
({ u'bj\xc3rn': 2 }, psycopg2.ProgrammingError),
|
({u'bj\xc3rn': 2}, psycopg2.ProgrammingError),
|
||||||
({ 3: 2 }, TypeError),
|
({3: 2}, TypeError),
|
||||||
({ self: 2 }, TypeError),
|
({self: 2}, TypeError),
|
||||||
]
|
]
|
||||||
for parameter_sequence, exception in failing_cases:
|
for parameter_sequence, exception in failing_cases:
|
||||||
self.assertRaises(exception, cur.callproc, procname, parameter_sequence)
|
self.assertRaises(exception, cur.callproc, procname, parameter_sequence)
|
||||||
self.conn.rollback()
|
self.conn.rollback()
|
||||||
|
|
||||||
def test_callproc_badparam(self):
|
|
||||||
cur = self.conn.cursor()
|
|
||||||
self.assertRaises(TypeError, cur.callproc, 'lower', 42)
|
|
||||||
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user