X-Git-Url: https://git.phdru.name/?p=sqlconvert.git;a=blobdiff_plain;f=tests%2Ftest_mysql2postgres.py;h=6782c5408eeef1b33335339da8e32a7ac9126ed8;hp=971970cdd612306d76f90468fc367e4a8d6f3cb5;hb=b8225ccc168f04789db1935a90462b5cb0bbd6a6;hpb=6d906e2f335699348bf44a653ca708b522a99d85 diff --git a/tests/test_mysql2postgres.py b/tests/test_mysql2postgres.py index 971970c..6782c54 100644 --- a/tests/test_mysql2postgres.py +++ b/tests/test_mysql2postgres.py @@ -4,6 +4,7 @@ import pytest from sqlconvert.print_tokens import tlist2str from sqlconvert.process_mysql import unescape_strings +from sqlconvert.process_tokens import escape_strings connection = getConnection() pytestmark = pytest.mark.skipif(connection.dbName != "postgres", @@ -22,9 +23,10 @@ def test_mysql2postgres_string(): parsed = parse("insert into test (id, test_str) values " "(1, '\"te\\'st\\\"\\n')")[0] unescape_strings(parsed) + escape_strings(parsed, 'postgres') query = tlist2str(parsed) assert query == u"INSERT INTO test (id, test_str) VALUES " \ - u"(1, '\"te''st\"\n')" + u"(1, E'\"te''st\"\\n')" connection.query(query) test_str = connection.queryOne("SELECT test_str FROM test WHERE id=1")[0] assert test_str == u"\"te'st\"\n"