@@ -122,13 +122,20 @@ def test_table_definition_parser(self, setupLogging):
122122 @pytest .mark .parametrize ("sqlExpr, expectedText" ,
123123 [("named_struct('name', city_name, 'id', city_id, 'population', city_pop)" ,
124124 "named_struct(' ', city_name, ' ', city_id, ' ', city_pop)" ),
125+ ("named_struct('name', `city 2`, 'id', city_id, 'population', city_pop)" ,
126+ "named_struct(' ', `city 2`, ' ', city_id, ' ', city_pop)" ),
127+ ("named_struct('`name 1`', `city 2`, 'id', city_id, 'population', city_pop)" ,
128+ "named_struct(' ', `city 2`, ' ', city_id, ' ', city_pop)" ),
129+ ("named_struct('`name 1`', city, 'id', city_id, 'population', city_pop)" ,
130+ "named_struct(' ', city, ' ', city_id, ' ', city_pop)" ),
125131 ("cast(10 as decimal(10)" ,
126132 "cast(10 as decimal(10)" ),
127133 (" " , " " ),
128134 ("" , "" ),
129135 ])
130136 def test_sql_expression_cleanser (self , sqlExpr , expectedText ):
131137 newSql = dg .SchemaParser ._cleanseSQL (sqlExpr )
138+ print (newSql )
132139 assert sqlExpr == expectedText or sqlExpr != newSql
133140
134141 assert newSql == expectedText
@@ -142,6 +149,7 @@ def test_sql_expression_cleanser(self, sqlExpr, expectedText):
142149 ['city_name' , 'city_pop' ]),
143150 ("cast(10 as decimal(10)" , ['cast' , 'as' , 'decimal' ], None ),
144151 ("cast(x as decimal(10)" , ['x' ], ['x' ]),
152+ ("cast(`city 2` as decimal(10)" , ['cast' , 'city 2' , 'as' , 'decimal' ], None ),
145153 (" " , [], None ),
146154 ("" , [], None ),
147155 ])
0 commit comments