Skip to content

Commit 0dfce06

Browse files
committed
Add test for _mysql.escape_string()
1 parent 4481bdb commit 0dfce06

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/test_MySQLdb_nonstandard.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ def test_client_info(self):
4141
def test_thread_safe(self):
4242
self.assertTrue(isinstance(_mysql.thread_safe(), int))
4343

44+
def test_escape_string(self):
45+
self.assertEqual(_mysql.escape_string(b'foo"bar'),
46+
b'foo\\"bar', "escape byte string")
47+
self.assertEqual(_mysql.escape_string(u'foo"bar'),
48+
b'foo\\"bar', "escape unicode string")
49+
4450

4551
class CoreAPI(unittest.TestCase):
4652
"""Test _mysql interaction internals."""

0 commit comments

Comments
 (0)