Changeset 603


Ignore:
Timestamp:
Nov 22, 2015, 11:26:34 AM (4 years ago)
Author:
cito
Message:

unescape_bytea() is actually stateless

Contrary to escape_bytea() and escape_string(), the unescape_bytea()
function does not depend on the connection. So we can leave the test
for unescape_bytea() in the module running without database.

Location:
trunk/module
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/TEST_PyGreSQL_classic_connection.py

    r602 r603  
    10741074
    10751075class TestStandaloneEscapeFunctions(unittest.TestCase):
    1076     """"Test pg escape and unescape functions.
     1076    """"Test pg escape functions.
    10771077
    10781078    The libpq interface memorizes some parameters of the last opened
     
    11271127        self.assertEqual(r, r'O\\000ps\\377!')
    11281128
    1129     def testUnescapeBytea(self):
    1130         f = pg.unescape_bytea
    1131         r = f(b'plain')
    1132         self.assertIsInstance(r, str)
    1133         self.assertEqual(r, 'plain')
    1134         r = f(u'plain')
    1135         self.assertIsInstance(r, str)
    1136         self.assertEqual(r, 'plain')
    1137         r = f(b"das is' k\\303\\244se")
    1138         self.assertIsInstance(r, str)
    1139         self.assertEqual(r, "das is' kÀse")
    1140         r = f(u"das is' k\\303\\244se")
    1141         self.assertIsInstance(r, str)
    1142         self.assertEqual(r, "das is' kÀse")
    1143         r = f(r'O\\000ps\\377!')
    1144         self.assertEqual(r, r'O\000ps\377!')
    1145 
    11461129
    11471130if __name__ == '__main__':
  • trunk/module/TEST_PyGreSQL_classic_functions.py

    r602 r603  
    304304        self.assertIsInstance(r, str)
    305305        self.assertEqual(r, 'plain')
    306         r = f("that's cheese")
    307         self.assertIsInstance(r, str)
    308         self.assertEqual(r, "that's cheese")
     306        r = f(b"das is' k\\303\\244se")
     307        self.assertIsInstance(r, str)
     308        self.assertEqual(r, "das is' kÀse")
     309        r = f(u"das is' k\\303\\244se")
     310        self.assertIsInstance(r, str)
     311        self.assertEqual(r, "das is' kÀse")
     312        r = f(r'O\\000ps\\377!')
     313        self.assertEqual(r, r'O\000ps\377!')
    309314
    310315
Note: See TracChangeset for help on using the changeset viewer.