Changeset 633


Ignore:
Timestamp:
Nov 26, 2015, 10:46:13 AM (4 years ago)
Author:
cito
Message:

Test for bool should no test other things

Whether or not fetchall() returns tuples or lists should not
matter in the test for the bool data type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/TEST_PyGreSQL_dbapi20.py

    r630 r633  
    246246
    247247    def test_bool(self):
    248         values = [[0, False], [1, True], [2, None],
    249                   [3, 't'], [4, 'f'], [5, 'true'], [6, 'false']]
     248        values = [False, True, None, 't', 'f', 'true', 'false']
    250249        table = self.table_prefix + 'booze'
    251250        con = self._connect()
     
    254253            cur.execute(
    255254                "create table %s (n smallint, booltest bool)" % table)
    256             cur.executemany("insert into %s values (%%s,%%s)" % table, values)
     255            params = enumerate(values)
     256            cur.executemany("insert into %s values (%%s,%%s)" % table, params)
    257257            cur.execute("select * from %s order by 1" % table)
    258258            rows = cur.fetchall()
    259259        finally:
    260260            con.close()
    261         values[3][1] = values[5][1] = True
    262         values[4][1] = values[6][1] = False
     261        rows = [row[1] for row in rows]
     262        values[3] = values[5] = True
     263        values[4] = values[6] = False
    263264        self.assertEqual(rows, values)
    264265
Note: See TracChangeset for help on using the changeset viewer.