Changeset 598


Ignore:
Timestamp:
Nov 22, 2015, 8:36:55 AM (4 years ago)
Author:
cito
Message:

Testing large objects set to Unicode content

Location:
trunk/module
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/TEST_PyGreSQL_classic_dbwrapper.py

    r592 r598  
    299299    def testModuleName(self):
    300300        self.assertEqual(self.db.__module__, 'pg')
     301        self.assertEqual(self.db.__class__.__module__, 'pg')
    301302
    302303    def testEscapeLiteral(self):
  • trunk/module/TEST_PyGreSQL_classic_largeobj.py

    r597 r598  
    251251        self.assertEqual(r, data)
    252252
     253    def testWriteLatin1Bytes(self):
     254        read = self.obj.read
     255        self.obj.open(pg.INV_WRITE)
     256        self.obj.write(u'kÀse'.encode('latin1'))
     257        self.obj.close()
     258        self.obj.open(pg.INV_READ)
     259        r = read(80)
     260        self.assertIsInstance(r, bytes)
     261        self.assertEqual(r.decode('latin1'), u'kÀse')
     262
     263    def testWriteUtf8Bytes(self):
     264        read = self.obj.read
     265        self.obj.open(pg.INV_WRITE)
     266        self.obj.write(u'kÀse'.encode('utf8'))
     267        self.obj.close()
     268        self.obj.open(pg.INV_READ)
     269        r = read(80)
     270        self.assertIsInstance(r, bytes)
     271        self.assertEqual(r.decode('utf8'), u'kÀse')
     272
     273    def testWriteUtf8String(self):
     274        read = self.obj.read
     275        self.obj.open(pg.INV_WRITE)
     276        self.obj.write('kÀse')
     277        self.obj.close()
     278        self.obj.open(pg.INV_READ)
     279        r = read(80)
     280        self.assertIsInstance(r, bytes)
     281        self.assertEqual(r.decode('utf8'), u'kÀse')
     282
    253283    def testSeek(self):
    254284        seek = self.obj.seek
Note: See TracChangeset for help on using the changeset viewer.