From 251d3c95ba1c7a02f0d221cff72a0ddd404aec56 Mon Sep 17 00:00:00 2001 From: dnwpark Date: Fri, 15 Mar 2024 18:16:24 -0400 Subject: [PATCH] Remove unescape_string. --- edb/common/string.py | 20 -------------------- tests/common/test_string.py | 4 ---- tests/test_edgeql_data_migration.py | 3 +-- 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/edb/common/string.py b/edb/common/string.py index b8e5a707624..6cb56cdb134 100644 --- a/edb/common/string.py +++ b/edb/common/string.py @@ -35,23 +35,3 @@ def escape_string(s: str) -> str: result = result.replace('\t', '\\t') return result - - -def unescape_string(s: str) -> str: - split = s.split('\\\\') - - def unescape_non_backslash(s: str) -> str: - result = s - - result = result.replace('\\\'', '\'') - result = result.replace('\\\"', '\"') - result = result.replace('\\b', '\b') - result = result.replace('\\f', '\f') - result = result.replace('\\n', '\n') - result = result.replace('\\r', '\r') - result = result.replace('\\t', '\t') - - return result - - return '\\'.join(unescape_non_backslash(r) - for r in split) diff --git a/tests/common/test_string.py b/tests/common/test_string.py index 2c2627a680f..df8986630fe 100644 --- a/tests/common/test_string.py +++ b/tests/common/test_string.py @@ -46,7 +46,3 @@ class StringTests(unittest.TestCase): def test_escape_string(self): for unescaped, escaped in StringTests.unescaped_escaped_strings: self.assertEqual(string.escape_string(unescaped), escaped) - - def test_unescape_string(self): - for unescaped, escaped in StringTests.unescaped_escaped_strings: - self.assertEqual(string.unescape_string(escaped), unescaped) diff --git a/tests/test_edgeql_data_migration.py b/tests/test_edgeql_data_migration.py index 58040fadf38..d67b9995594 100644 --- a/tests/test_edgeql_data_migration.py +++ b/tests/test_edgeql_data_migration.py @@ -28,7 +28,6 @@ import edgedb from edb.common import assert_data_shape -from edb.common.string import unescape_string from edb.testbase import server as tb from edb.testbase import serutils @@ -141,7 +140,7 @@ async def fast_forward_describe_migration( interpolations[var_name] = var_value for stmt in mig['proposed']['statements']: - curddl = unescape_string(stmt['text']) + curddl = stmt['text'] if interpolations: def _replace(match, interpolations=interpolations):