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 0dfce06

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

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed

‎tests/test_MySQLdb_nonstandard.py

Copy file name to clipboardExpand all lines: tests/test_MySQLdb_nonstandard.py
+6Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.