File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 66from xdiff .database import connect_to_uri
77from xdiff .diff_tables import TableDiffer , TableSegment
88
9- from .common import str_to_checksum , TEST_MYSQL_CONN_STRING
9+ from .common import TEST_MYSQL_CONN_STRING , str_to_checksum
1010
1111
1212class TestDiffTables (unittest .TestCase ):
Original file line number Diff line number Diff line change 1+ import unittest
2+
3+ from xdiff .database import connect_to_uri
4+ from xdiff .sql import Compiler , Select , TableName
5+
6+ from .common import TEST_MYSQL_CONN_STRING
7+
8+
9+ class TestSQL (unittest .TestCase ):
10+ def setUp (self ):
11+ self .mysql = connect_to_uri (TEST_MYSQL_CONN_STRING )
12+ self .compiler = Compiler (self .mysql )
13+
14+ def test_compile_string (self ):
15+ self .assertEqual ("SELECT 1" , self .compiler .compile ("SELECT 1" ))
16+
17+ def test_compile_int (self ):
18+ self .assertEqual ("1" , self .compiler .compile (1 ))
19+
20+ def test_compile_table_name (self ):
21+ self .assertEqual ("`marine_mammals.walrus`" , self .compiler .compile (
22+ TableName (("marine_mammals" , "walrus" ))))
23+
24+ def test_compile_select (self ):
25+ expected_sql = "SELECT name FROM `marine_mammals.walrus`"
26+ self .assertEqual (expected_sql , self .compiler .compile (
27+ Select (
28+ ["name" ],
29+ TableName (("marine_mammals" , "walrus" )),
30+ ))
31+ )
You can’t perform that action at this time.
0 commit comments