本文整理汇总了Python中sacred.config.signature.Signature.construct_arguments方法的典型用法代码示例。如果您正苦于以下问题:Python Signature.construct_arguments方法的具体用法?Python Signature.construct_arguments怎么用?Python Signature.construct_arguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sacred.config.signature.Signature
的用法示例。
在下文中一共展示了Signature.construct_arguments方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_construct_arguments_completes_kwargs_from_options
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_completes_kwargs_from_options():
s = Signature(bariza)
args, kwargs = s.construct_arguments([2, 4], {}, {'c': 6})
assert args == [2, 4]
assert kwargs == {'c': 6}
s = Signature(complex_function_name)
args, kwargs = s.construct_arguments([], {'c': 6, 'b': 7}, {'a': 1})
assert args == []
assert kwargs == {'a': 1, 'c': 6, 'b': 7}
示例2: test_construct_arguments_with_duplicate_args_raises_typeerror
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_with_duplicate_args_raises_typeerror():
multiple_values = re.compile(".*multiple values.*")
with pytest.raises(TypeError) as excinfo:
s = Signature(bariza)
s.construct_arguments([1, 2, 3], {'a': 4, 'b': 5}, {})
assert multiple_values.match(excinfo.value.args[0])
with pytest.raises(TypeError) as excinfo:
s = Signature(complex_function_name)
s.construct_arguments([1], {'a': 4}, {})
assert multiple_values.match(excinfo.value.args[0])
示例3: test_construct_arguments_without_options_returns_same_args_kwargs
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_without_options_returns_same_args_kwargs():
s = Signature(foo)
args, kwargs = s.construct_arguments([], {}, {})
assert args == []
assert kwargs == {}
s = Signature(bariza)
args, kwargs = s.construct_arguments([2, 4, 6], {}, {})
assert args == [2, 4, 6]
assert kwargs == {}
s = Signature(complex_function_name)
args, kwargs = s.construct_arguments([2], {'c': 6, 'b': 7}, {})
assert args == [2]
assert kwargs == {'c': 6, 'b': 7}
示例4: test_construct_arguments_raises_if_args_unfilled
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_raises_if_args_unfilled():
s = Signature(bariza)
missing = re.compile(".*missing.*")
with pytest.raises(MissingConfigError) as excinfo:
s.construct_arguments([], {}, {})
assert missing.match(excinfo.value.args[0])
with pytest.raises(MissingConfigError) as excinfo:
s.construct_arguments([1, 2], {}, {})
assert missing.match(excinfo.value.args[0])
with pytest.raises(MissingConfigError) as excinfo:
s.construct_arguments([1], {'b': 3}, {})
assert missing.match(excinfo.value.args[0])
with pytest.raises(MissingConfigError) as excinfo:
s.construct_arguments([1], {'c': 5}, {})
assert missing.match(excinfo.value.args[0])
示例5: test_construct_arguments_without_duplicates_passes
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_without_duplicates_passes():
s = Signature(bariza)
s.construct_arguments([1, 2], {'c': 5}, {})
s = Signature(complex_function_name)
s.construct_arguments([1], {'b': 4}, {})
s = Signature(FunCTIonWithCAPItals)
s.construct_arguments([], {'a': 6, 'b': 6, 'c': 6}, {})
示例6: test_construct_arguments_for_bound_method
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_for_bound_method():
s = Signature(SomeClass.bla)
args, kwargs = s.construct_arguments([1], {'b': 2}, {'c': 3}, bound=True)
assert args == [1]
assert kwargs == {'b': 2, 'c': 3}
示例7: test_construct_arguments_does_not_raise_for_missing_defaults
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_does_not_raise_for_missing_defaults():
s = Signature(complex_function_name)
s.construct_arguments([], {}, {})
示例8: test_construct_arguments_does_not_raise_if_all_args_filled
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_does_not_raise_if_all_args_filled():
s = Signature(bariza)
s.construct_arguments([1, 2, 3], {}, {})
s.construct_arguments([1, 2], {'c': 6}, {})
s.construct_arguments([1], {'b': 6, 'c': 6}, {})
s.construct_arguments([], {'a': 6, 'b': 6, 'c': 6}, {})
示例9: test_construct_arguments_overwrites_defaults
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_overwrites_defaults():
s = Signature(complex_function_name)
args, kwargs = s.construct_arguments([], {}, {'a': 11, 'b': 12, 'c': 7})
assert args == []
assert kwargs == {'a': 11, 'b': 12, 'c': 7}
示例10: test_construct_arguments_does_not_overwrite_args_and_kwargs
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_does_not_overwrite_args_and_kwargs():
s = Signature(bariza)
args, kwargs = s.construct_arguments([1, 2], {'c': 3},
{'a': 6, 'b': 6, 'c': 6})
assert args == [1, 2]
assert kwargs == {'c': 3}
示例11: test_construct_arguments_ignores_excess_options
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_ignores_excess_options():
s = Signature(bariza)
args, kwargs = s.construct_arguments([2], {'b': 4},
{'c': 6, 'foo': 9, 'bar': 0})
assert args == [2]
assert kwargs == {'b': 4, 'c': 6}
示例12: test_construct_arguments_with_kwargs_for_posargs_does_not_raise
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_with_kwargs_for_posargs_does_not_raise():
Signature(bariza).construct_arguments([], {'a': 4, 'b': 3, 'c': 2}, {})
s = Signature(FunCTIonWithCAPItals)
s.construct_arguments([], {'a': 4, 'b': 3, 'c': 2, 'd': 6}, {})
示例13: test_construct_arguments_with_expected_kwargs_does_not_raise
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_with_expected_kwargs_does_not_raise():
s = Signature(complex_function_name)
s.construct_arguments([], {'a': 4, 'b': 3, 'c': 2}, {})
s = Signature(FunCTIonWithCAPItals)
s.construct_arguments([1, 2], {'c': 5}, {})
示例14: test_construct_arguments_without_duplicates_passes
# 需要导入模块: from sacred.config.signature import Signature [as 别名]
# 或者: from sacred.config.signature.Signature import construct_arguments [as 别名]
def test_construct_arguments_without_duplicates_passes():
s = Signature(bariza)
s.construct_arguments([1, 2], {'c': 5}, {})
s = Signature(complex_function_name)
s.construct_arguments([1], {'b': 4}, {})