Changeset 568 for trunk


Ignore:
Timestamp:
Nov 21, 2015, 8:10:58 AM (4 years ago)
Author:
cito
Message:

We can assume namedtuples are always available

Since we require at least Python 2.6 in the trunk,
we don't need to check this any more.

Location:
trunk/module
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/TEST_PyGreSQL_classic_connection.py

    r565 r568  
    2626
    2727from decimal import Decimal
    28 
    29 from collections import namedtuple
    3028
    3129# We need a database to test against.  If LOCAL_PyGreSQL.py exists we will
     
    293291        self.assertEqual(v, result)
    294292
    295     @unittest.skipUnless(namedtuple, 'Named tuples not available')
    296293    def testNamedresult(self):
    297294        q = "select 0 as alias0"
     
    315312        self.assertEqual(r, result)
    316313
    317     @unittest.skipUnless(namedtuple, 'Named tuples not available')
    318314    def testGet3NamedCols(self):
    319315        q = "select 1 as a,2 as b,3 as c"
     
    338334        self.assertEqual(r, result)
    339335
    340     @unittest.skipUnless(namedtuple, 'Named tuples not available')
    341336    def testGet3NamedRows(self):
    342337        q = ("select 3 as alias3"
     
    358353        self.assertEqual(r, result)
    359354
    360     @unittest.skipUnless(namedtuple, 'Named tuples not available')
    361355    def testNamedresultNames(self):
    362356        q = "select 'MixedCase' as MixedCaseAlias"
     
    954948        pg.set_decimal(d)
    955949
    956     @unittest.skipUnless(namedtuple, 'Named tuples not available')
    957950    def testSetNamedresult(self):
    958951        query = self.c.query
  • trunk/module/pg.py

    r567 r568  
    110110
    111111
    112 if namedtuple:
    113 
    114     def _namedresult(q):
    115         """Get query result as named tuples."""
    116         row = namedtuple('Row', q.listfields())
    117         return [row(*r) for r in q.getresult()]
    118 
    119     set_namedresult(_namedresult)
     112def _namedresult(q):
     113    """Get query result as named tuples."""
     114    row = namedtuple('Row', q.listfields())
     115    return [row(*r) for r in q.getresult()]
     116
     117set_namedresult(_namedresult)
    120118
    121119
Note: See TracChangeset for help on using the changeset viewer.