diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-01 21:37:49 -0800 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-01 21:42:14 -0800 |
commit | e335d6d2234a7bb1d83741f851dba5dbbabd6e3c (patch) | |
tree | be5545f9f2c20bc41b500d4aac462fd40c0ea8d8 /tests | |
parent | a51160317c680662c52e4a1a6b4d11beae37f205 (diff) | |
download | psycopg2-e335d6d2234a7bb1d83741f851dba5dbbabd6e3c.tar.gz |
Trim trailing whitespace from all files throughout project
Many editors automatically trim whitespace on save. By trimming all
files in one go, makes future diffs cleaner without extraneous
whitespace changes.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dbapi20.py | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/tests/dbapi20.py b/tests/dbapi20.py index ff98ddc..4facf8e 100644 --- a/tests/dbapi20.py +++ b/tests/dbapi20.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -''' Python DB API 2.0 driver compliance unit test suite. - +''' Python DB API 2.0 driver compliance unit test suite. + This software is Public Domain and may be used without restrictions. "Now we have booze and barflies entering the discussion, plus rumours of @@ -79,8 +79,8 @@ def str2bytes(sval): class DatabaseAPI20Test(unittest.TestCase): ''' Test a database self.driver for DB API 2.0 compatibility. This implementation tests Gadfly, but the TestCase - is structured so that other self.drivers can subclass this - test case to ensure compiliance with the DB-API. It is + is structured so that other self.drivers can subclass this + test case to ensure compiliance with the DB-API. It is expected that this TestCase may be expanded in the future if ambiguities or edge conditions are discovered. @@ -90,9 +90,9 @@ class DatabaseAPI20Test(unittest.TestCase): self.driver, connect_args and connect_kw_args. Class specification should be as follows: - import dbapi20 + import dbapi20 class mytest(dbapi20.DatabaseAPI20Test): - [...] + [...] Don't 'import DatabaseAPI20Test from dbapi20', or you will confuse the unit tester - just 'import dbapi20'. @@ -111,7 +111,7 @@ class DatabaseAPI20Test(unittest.TestCase): xddl2 = 'drop table %sbarflys' % table_prefix lowerfunc = 'lower' # Name of stored procedure to convert string->lowercase - + # Some drivers may need to override these helpers, for example adding # a 'commit' after the execute. def executeDDL1(self,cursor): @@ -135,10 +135,10 @@ class DatabaseAPI20Test(unittest.TestCase): try: cur = con.cursor() for ddl in (self.xddl1,self.xddl2): - try: + try: cur.execute(ddl) con.commit() - except self.driver.Error: + except self.driver.Error: # Assume table didn't exist. Other tests will check if # execute is busted. pass @@ -255,7 +255,7 @@ class DatabaseAPI20Test(unittest.TestCase): con.rollback() except self.driver.NotSupportedError: pass - + def test_cursor(self): con = self._connect() try: @@ -411,7 +411,7 @@ class DatabaseAPI20Test(unittest.TestCase): ) elif self.driver.paramstyle == 'named': cur.execute( - 'insert into %sbooze values (:beer)' % self.table_prefix, + 'insert into %sbooze values (:beer)' % self.table_prefix, {'beer':"Cooper's"} ) elif self.driver.paramstyle == 'format': @@ -551,7 +551,7 @@ class DatabaseAPI20Test(unittest.TestCase): tests. ''' populate = [ - "insert into %sbooze values ('%s')" % (self.table_prefix,s) + "insert into %sbooze values ('%s')" % (self.table_prefix,s) for s in self.samples ] return populate @@ -612,7 +612,7 @@ class DatabaseAPI20Test(unittest.TestCase): self.assertEqual(len(rows),6) rows = [r[0] for r in rows] rows.sort() - + # Make sure we get the right data back out for i in range(0,6): self.assertEqual(rows[i],self.samples[i], @@ -683,10 +683,10 @@ class DatabaseAPI20Test(unittest.TestCase): 'cursor.fetchall should return an empty list if ' 'a select query returns no rows' ) - + finally: con.close() - + def test_mixedfetch(self): con = self._connect() try: @@ -722,7 +722,7 @@ class DatabaseAPI20Test(unittest.TestCase): def help_nextset_setUp(self,cur): ''' Should create a procedure called deleteme - that returns two result sets, first the + that returns two result sets, first the number of rows in booze then "name from booze" ''' raise NotImplementedError('Helper not implemented') @@ -869,4 +869,3 @@ class DatabaseAPI20Test(unittest.TestCase): self.failUnless(hasattr(self.driver,'ROWID'), 'module.ROWID must be defined.' ) - |