MCPcopy Index your code
hub / github.com/tobymao/sqlglot / test_simple

Method test_simple

tests/test_diff.py:12–48  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

10
11class TestDiff(unittest.TestCase):
12 def test_simple(self):
13 self._validate_delta_only(
14 diff_delta_only(parse_one("SELECT a + b"), parse_one("SELECT a - b")),
15 [
16 Remove(expression=parse_one("a + b")), # the Add node
17 Insert(expression=parse_one("a - b")), # the Sub node
18 Move(source=parse_one("a"), target=parse_one("a")), # the `a` Column node
19 Move(source=parse_one("b"), target=parse_one("b")), # the `b` Column node
20 ],
21 )
22
23 self._validate_delta_only(
24 diff_delta_only(parse_one("SELECT a, b, c"), parse_one("SELECT a, c")),
25 [
26 Remove(expression=parse_one("b")), # the Column node
27 ],
28 )
29
30 self._validate_delta_only(
31 diff_delta_only(parse_one("SELECT a, b"), parse_one("SELECT a, b, c")),
32 [
33 Insert(expression=parse_one("c")), # the Column node
34 ],
35 )
36
37 self._validate_delta_only(
38 diff_delta_only(
39 parse_one("SELECT a FROM table_one"),
40 parse_one("SELECT a FROM table_two"),
41 ),
42 [
43 Update(
44 source=exp.to_table("table_one", quoted=False),
45 target=exp.to_table("table_two", quoted=False),
46 ), # the Table node
47 ],
48 )
49
50 def test_lambda(self):
51 self._validate_delta_only(

Callers

nothing calls this directly

Calls 7

_validate_delta_onlyMethod · 0.95
parse_oneFunction · 0.90
RemoveClass · 0.90
InsertClass · 0.90
MoveClass · 0.90
UpdateClass · 0.90
diff_delta_onlyFunction · 0.85

Tested by

no test coverage detected