Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0e0b166

Browse filesBrowse files
committed
Fix failing tests
1 parent 1cc9494 commit 0e0b166
Copy full SHA for 0e0b166

File tree

Expand file treeCollapse file tree

1 file changed

+14
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-12
lines changed

‎pymysql/tests/test_issues.py

Copy file name to clipboardExpand all lines: pymysql/tests/test_issues.py
+14-12Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def test_issue_16(self):
145145

146146
@unittest2.skip("test_issue_17() requires a custom, legacy MySQL configuration and will not be run.")
147147
def test_issue_17(self):
148-
""" could not connect mysql use passwod """
148+
"""could not connect mysql use passwod"""
149149
conn = self.connections[0]
150150
host = self.databases[0]["host"]
151151
db = self.databases[0]["db"]
@@ -415,7 +415,7 @@ def test_issue_364(self):
415415

416416
sql = "insert into issue364 (value_1, value_2) values (%s, %s)"
417417
usql = u"insert into issue364 (value_1, value_2) values (%s, %s)"
418-
values = [b"\x00\xff\x00", u"\xe4\xf6\xfc"]
418+
values = [pymysql.Binary(b"\x00\xff\x00"), u"\xe4\xf6\xfc"]
419419

420420
# test single insert and select
421421
cur = conn.cursor()
@@ -446,30 +446,32 @@ def test_issue_363(self):
446446
"ENGINE=MyISAM default charset=utf8")
447447

448448
cur = conn.cursor()
449-
# FYI - not sure of 5.7.0 version
450-
if sys.version_info[0:2] >= (3,2) and self.mysql_server_is(conn, (5, 7, 0)):
449+
query = ("INSERT INTO issue363 (id, geom) VALUES"
450+
"(1998, GeomFromText('LINESTRING(1.1 1.1,2.2 2.2)'))")
451+
# From MySQL 5.7, ST_GeomFromText is added and GeomFromText is deprecated.
452+
if self.mysql_server_is(conn, (5, 7, 0)):
451453
with self.assertWarns(pymysql.err.Warning) as cm:
452-
cur.execute("INSERT INTO issue363 (id, geom) VALUES ("
453-
"1998, GeomFromText('LINESTRING(1.1 1.1,2.2 2.2)'))")
454+
cur.execute(query)
454455
else:
455-
cur.execute("INSERT INTO issue363 (id, geom) VALUES ("
456-
"1998, GeomFromText('LINESTRING(1.1 1.1,2.2 2.2)'))")
456+
cur.execute(query)
457457

458458
# select WKT
459+
query = "SELECT AsText(geom) FROM issue363"
459460
if sys.version_info[0:2] >= (3,2) and self.mysql_server_is(conn, (5, 7, 0)):
460461
with self.assertWarns(pymysql.err.Warning) as cm:
461-
cur.execute("SELECT AsText(geom) FROM issue363")
462+
cur.execute(query)
462463
else:
463-
cur.execute("SELECT AsText(geom) FROM issue363")
464+
cur.execute(query)
464465
row = cur.fetchone()
465466
self.assertEqual(row, ("LINESTRING(1.1 1.1,2.2 2.2)", ))
466467

467468
# select WKB
469+
query = "SELECT AsBinary(geom) FROM issue363"
468470
if sys.version_info[0:2] >= (3,2) and self.mysql_server_is(conn, (5, 7, 0)):
469471
with self.assertWarns(pymysql.err.Warning) as cm:
470-
cur.execute("SELECT AsBinary(geom) FROM issue363")
472+
cur.execute(query)
471473
else:
472-
cur.execute("SELECT AsBinary(geom) FROM issue363")
474+
cur.execute(query)
473475
row = cur.fetchone()
474476
self.assertEqual(row,
475477
(b"\x01\x02\x00\x00\x00\x02\x00\x00\x00"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.