2121from sqlmesh .core .dialect import format_model_expressions , parse
2222from sqlmesh .core .model import load_model
2323from sqlmesh .core .test import ModelTestMetadata , get_all_model_tests
24+ from sqlmesh .utils import yaml
2425from sqlmesh .utils .errors import MagicError , MissingContextException
25- from sqlmesh .utils .yaml import YAML
26- from sqlmesh .utils .yaml import dumps as yaml_dumps
27- from sqlmesh .utils .yaml import load as yaml_load
2826
2927CONTEXT_VARIABLE_NAMES = [
3028 "context" ,
@@ -208,8 +206,8 @@ def test(self, line: str, test_def_raw: t.Optional[str] = None) -> None:
208206 return
209207
210208 test = tests [model .name ][args .test_name ]
211- test_def = yaml_load (test_def_raw ) if test_def_raw else test .body
212- test_def_output = yaml_dumps (test_def )
209+ test_def = yaml . load (test_def_raw ) if test_def_raw else test .body
210+ test_def_output = yaml . dump (test_def )
213211
214212 self ._shell .set_next_input (
215213 "\n " .join (
@@ -222,10 +220,10 @@ def test(self, line: str, test_def_raw: t.Optional[str] = None) -> None:
222220 )
223221
224222 with open (test .path , "r+" , encoding = "utf-8" ) as file :
225- content = yaml_load (file .read ())
223+ content = yaml . load (file .read ())
226224 content [args .test_name ] = test_def
227225 file .seek (0 )
228- YAML () .dump (content , file )
226+ yaml .dump (content , file )
229227 file .truncate ()
230228
231229 @magic_arguments ()
0 commit comments