mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-15 05:26:37 +03:00
Fixed encoding tests on Py3
This commit is contained in:
parent
2b52469a0b
commit
c585478dd1
|
@ -169,7 +169,7 @@ class TestQuotedString(ConnectingTestCase):
|
||||||
from psycopg2.extensions import adapt
|
from psycopg2.extensions import adapt
|
||||||
a = adapt("hello")
|
a = adapt("hello")
|
||||||
self.assertEqual(a.encoding, 'latin1')
|
self.assertEqual(a.encoding, 'latin1')
|
||||||
self.assertEqual(a.getquoted(), "'hello'")
|
self.assertEqual(a.getquoted(), b("'hello'"))
|
||||||
|
|
||||||
# NOTE: we can't really test an encoding different from utf8, because
|
# NOTE: we can't really test an encoding different from utf8, because
|
||||||
# when encoding without connection the libpq will use parameters from
|
# when encoding without connection the libpq will use parameters from
|
||||||
|
@ -192,7 +192,7 @@ class TestQuotedString(ConnectingTestCase):
|
||||||
a = adapt(snowman)
|
a = adapt(snowman)
|
||||||
a.encoding = 'utf8'
|
a.encoding = 'utf8'
|
||||||
self.assertEqual(a.encoding, 'utf8')
|
self.assertEqual(a.encoding, 'utf8')
|
||||||
self.assertEqual(a.getquoted(), "'\xe2\x98\x83'")
|
self.assertEqual(a.getquoted(), b("'\xe2\x98\x83'"))
|
||||||
|
|
||||||
def test_connection_wins_anyway(self):
|
def test_connection_wins_anyway(self):
|
||||||
from psycopg2.extensions import adapt
|
from psycopg2.extensions import adapt
|
||||||
|
@ -204,7 +204,7 @@ class TestQuotedString(ConnectingTestCase):
|
||||||
a.prepare(self.conn)
|
a.prepare(self.conn)
|
||||||
|
|
||||||
self.assertEqual(a.encoding, 'utf_8')
|
self.assertEqual(a.encoding, 'utf_8')
|
||||||
self.assertEqual(a.getquoted(), "'\xe2\x98\x83'")
|
self.assertEqual(a.getquoted(), b("'\xe2\x98\x83'"))
|
||||||
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user