mirror of
https://gitee.com/mindspore/mindformers.git
synced 2025-12-06 11:29:59 +08:00
!6744 【dev】【用例】【bugfix】修复yaml深度测试用例问题
Merge pull request !6744 from zyw_hw/fix_check_rules_case
This commit is contained in:
@@ -53,15 +53,15 @@ class TestCheckYamlDepthBeforeLoading(unittest.TestCase):
|
||||
assert check_yaml_depth_before_loading(self.yaml_str)
|
||||
with open(self.yaml_path, encoding='utf-8') as fp:
|
||||
node = yaml.compose(fp)
|
||||
assert get_yaml_ast_depth(node) == 3
|
||||
assert get_yaml_ast_depth(node) == 4
|
||||
fp.seek(0)
|
||||
check_yaml_depth_before_loading(fp)
|
||||
fp.seek(0)
|
||||
cfg_dict = yaml.safe_load(fp)
|
||||
assert cfg_dict["model"]["model_config"]["num_layers"] == 32
|
||||
assert cfg_dict["model"]["model_config"]["num_layers"] == 40
|
||||
fp.seek(0)
|
||||
cfg_dict = yaml.load(fp, Loader=yaml.SafeLoader)
|
||||
assert cfg_dict["model"]["model_config"]["num_layers"] == 32
|
||||
assert cfg_dict["model"]["model_config"]["num_layers"] == 40
|
||||
fp.seek(0)
|
||||
cfg_dict = yaml.safe_load(fp.read())
|
||||
assert cfg_dict["model"]["model_config"]["num_layers"] == 32
|
||||
assert cfg_dict["model"]["model_config"]["num_layers"] == 40
|
||||
|
||||
Reference in New Issue
Block a user