Add test for _mysql.escape_string()

This commit is contained in:
INADA Naoki
2015-02-24 14:36:03 +09:00
parent 4481bdbd02
commit 0dfce06514

View File

@@ -41,6 +41,12 @@ class CoreModule(unittest.TestCase):
def test_thread_safe(self):
self.assertTrue(isinstance(_mysql.thread_safe(), int))
def test_escape_string(self):
self.assertEqual(_mysql.escape_string(b'foo"bar'),
b'foo\\"bar', "escape byte string")
self.assertEqual(_mysql.escape_string(u'foo"bar'),
b'foo\\"bar', "escape unicode string")
class CoreAPI(unittest.TestCase):
"""Test _mysql interaction internals."""