summaryrefslogtreecommitdiffstats
path: root/tests/test_diff.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-04-03 07:31:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-04-03 07:31:54 +0000
commitb38d717d5933fdae3fe85c87df7aee9a251fb58e (patch)
tree6db21a44ffea4c832dcab29688bfaf1c1dc124f9 /tests/test_diff.py
parentReleasing debian version 11.4.1-1. (diff)
downloadsqlglot-b38d717d5933fdae3fe85c87df7aee9a251fb58e.tar.xz
sqlglot-b38d717d5933fdae3fe85c87df7aee9a251fb58e.zip
Merging upstream version 11.4.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_diff.py')
-rw-r--r--tests/test_diff.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_diff.py b/tests/test_diff.py
index 372af70..d5fa163 100644
--- a/tests/test_diff.py
+++ b/tests/test_diff.py
@@ -155,6 +155,19 @@ class TestDiff(unittest.TestCase):
with self.assertRaises(ValueError):
diff(expr_src, expr_tgt, matchings=[(expr_src, expr_tgt), (expr_src, expr_tgt)])
+ def test_identifier(self):
+ expr_src = parse_one("SELECT a FROM tbl")
+ expr_tgt = parse_one("SELECT a, tbl.b from tbl")
+
+ self._validate_delta_only(
+ diff(expr_src, expr_tgt),
+ [
+ Insert(expression=exp.to_identifier("b")),
+ Insert(expression=exp.to_column("tbl.b")),
+ Insert(expression=exp.to_identifier("tbl")),
+ ],
+ )
+
def _validate_delta_only(self, actual_diff, expected_delta):
actual_delta = _delta_only(actual_diff)
self.assertEqual(set(actual_delta), set(expected_delta))