Skip to content

Commit 2fe6224

Browse files
committed
fix(test): match normalize_source output across Python versions
Signed-off-by: lafirm <136463254+lafirm@users.noreply.github.com>
1 parent 1266f1e commit 2fe6224

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/utils/test_metaprogramming.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ast
12
import typing as t
23
from contextlib import contextmanager
34
from dataclasses import dataclass
@@ -50,7 +51,7 @@ def test_print_exception(mocker: MockerFixture):
5051
except Exception as ex:
5152
print_exception(ex, test_env, out_mock)
5253

53-
expected_message = r""" File ".*?.tests.utils.test_metaprogramming\.py", line 49, in test_print_exception
54+
expected_message = r""" File ".*?.tests.utils.test_metaprogramming\.py", line 50, in test_print_exception
5455
eval\("test_fun\(\)", env\).*
5556
5657
File '/test/path.py' \(or imported file\), line 2, in test_fun
@@ -368,7 +369,8 @@ def sample_context_manager():
368369
"my_lambda": Executable(
369370
name="my_lambda",
370371
path="test_metaprogramming.py",
371-
payload="my_lambda = lambda: print('z')",
372+
# Match normalize_source output across Python versions
373+
payload=ast.unparse(ast.parse("my_lambda = lambda: print('z')")).strip(),
372374
),
373375
"normalize_model_name": Executable(
374376
payload="from sqlmesh.core.dialect import normalize_model_name",

0 commit comments

Comments
 (0)