提交 222cd4ad authored 作者: ricardoV94's avatar ricardoV94 提交者: Ricardo Vieira

Remove error check in ConfigParser

上级 46fdc58e
......@@ -236,11 +236,7 @@ class PyTensorConfigParser:
raise ValueError(
f"Dot-based sections were removed. Use double underscores! ({name})"
)
# Can't use hasattr here, because it returns False upon AttributeErrors
if name in dir(self):
raise AttributeError(
f"A config parameter with the name '{name}' was already registered on another config instance."
)
configparam.doc = doc
configparam.name = name
configparam.in_c_key = in_c_key
......
......@@ -194,15 +194,6 @@ def test_invalid_configvar_access():
with pytest.raises(configparser.ConfigAccessViolation, match="different instance"):
print(root.test__on_test_instance)
# And also that we can't add two configs of the same name to different instances:
with pytest.raises(AttributeError, match="already registered"):
root.add(
"test__on_test_instance",
"This config setting was already added to another instance.",
configparser.IntParam(5),
in_c_key=False,
)
def test_no_more_dotting():
root = configdefaults.config
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论