Changeset 821 for trunk/tests


Ignore:
Timestamp:
Feb 5, 2016, 11:13:54 AM (4 years ago)
Author:
cito
Message:

Support the uuid data type

This is often useful and also supported by SQLAlchemy

Location:
trunk/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/test_classic_dbwrapper.py

    r820 r821  
    2525from decimal import Decimal
    2626from datetime import date, time, datetime, timedelta
     27from uuid import UUID
    2728from time import strftime
    2829from operator import itemgetter
     
    37033704        self.assertEqual(r, d)
    37043705
     3706    def testUuid(self):
     3707        d = UUID('{12345678-1234-5678-1234-567812345678}')
     3708        q = 'select $1::uuid'
     3709        r = self.db.query(q, (d,)).getresult()[0][0]
     3710        self.assertIsInstance(r, UUID)
     3711        self.assertEqual(r, d)
     3712
    37053713    def testDbTypesInfo(self):
    37063714        dbtypes = self.db.dbtypes
  • trunk/tests/test_dbapi20.py

    r817 r821  
    3030
    3131from datetime import date, time, datetime, timedelta
     32from uuid import UUID
    3233
    3334try:
     
    615616            con.close()
    616617        self.assertIsInstance(result, dict)
     618        self.assertEqual(result, d)
     619
     620    def test_uuid(self):
     621        d = UUID('{12345678-1234-5678-1234-567812345678}')
     622        con = self._connect()
     623        try:
     624            cur = con.cursor()
     625            cur.execute("select %s::uuid", (d,))
     626            result = cur.fetchone()[0]
     627        finally:
     628            con.close()
     629        self.assertIsInstance(result, UUID)
    617630        self.assertEqual(result, d)
    618631
Note: See TracChangeset for help on using the changeset viewer.