99from sqlglot .expressions import to_table
1010
1111import tests .utils .test_date as test_date
12+ from sqlmesh .core .dialect import normalize_model_name
1213from sqlmesh .core import constants as c
1314from sqlmesh .utils .errors import SQLMeshError
1415from sqlmesh .utils .metaprogramming import (
@@ -42,7 +43,7 @@ def test_print_exception(mocker: MockerFixture):
4243
4344 expected_message = f"""Traceback (most recent call last):
4445
45- File "{ __file__ } ", line 39 , in test_print_exception
46+ File "{ __file__ } ", line 40 , in test_print_exception
4647 eval("test_fun()", env)
4748
4849 File "<string>", line 1, in <module>
@@ -109,6 +110,7 @@ def main_func(y: int) -> int:
109110 MyClass ()
110111 DataClass (x = y )
111112 noop_metadata ()
113+ normalize_model_name ("test" )
112114
113115 def closure (z : int ) -> int :
114116 return z + Z
@@ -123,6 +125,7 @@ def test_func_globals() -> None:
123125 "DataClass" : DataClass ,
124126 "MyClass" : MyClass ,
125127 "noop_metadata" : noop_metadata ,
128+ "normalize_model_name" : normalize_model_name ,
126129 "other_func" : other_func ,
127130 "sqlglot" : sqlglot ,
128131 }
@@ -155,6 +158,7 @@ def test_normalize_source() -> None:
155158 MyClass()
156159 DataClass(x=y)
157160 noop_metadata()
161+ normalize_model_name('test')
158162
159163 def closure(z: int):
160164 return z + Z
@@ -195,6 +199,7 @@ def test_serialize_env() -> None:
195199 MyClass()
196200 DataClass(x=y)
197201 noop_metadata()
202+ normalize_model_name('test')
198203
199204 def closure(z: int):
200205 return z + Z
@@ -252,6 +257,10 @@ def baz(self):
252257 return None""" ,
253258 is_metadata = True ,
254259 ),
260+ "normalize_model_name" : Executable (
261+ payload = "from sqlmesh.core.dialect import normalize_model_name" ,
262+ kind = ExecutableKind .IMPORT ,
263+ ),
255264 "other_func" : Executable (
256265 name = "other_func" ,
257266 path = "test_metaprogramming.py" ,
0 commit comments