本文整理汇总了Python中sacred.config.signature.Signature类的典型用法代码示例。如果您正苦于以下问题:Python Signature类的具体用法?Python Signature怎么用?Python Signature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Signature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_construct_arguments_completes_kwargs_from_options
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_get_free_parameters
def test_get_free_parameters():
free = Signature(foo).get_free_parameters([], {})
assert free == []
free = Signature(bariza).get_free_parameters([], {'c': 3})
assert free == ['a', 'b']
free = Signature(complex_function_name).get_free_parameters([], {})
assert free == ['a', 'b', 'c']
free = Signature(_name_with_underscore_).get_free_parameters([], {})
assert free == ['fo', 'bar']
s = Signature(__double_underscore__)
assert s.get_free_parameters([1, 2, 3], {}) == []
示例3: test_construct_arguments_without_duplicates_passes
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}, {})
示例4: test_construct_arguments_with_duplicate_args_raises_typeerror
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])
with pytest.raises(TypeError) as excinfo:
s = Signature(FunCTIonWithCAPItals)
s.construct_arguments([1, 2, 3], {'c': 6}, {})
assert multiple_values.match(excinfo.value.args[0])
示例5: test_construct_arguments_raises_if_args_unfilled
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])
示例6: test_construct_arguments_without_options_returns_same_args_kwargs
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}
s = Signature(_name_with_underscore_)
args, kwargs = s.construct_arguments([], {'fo': 7, 'bar': 6}, {})
assert args == []
assert kwargs == {'fo': 7, 'bar': 6}
示例7: test_construct_arguments_for_bound_method
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}
示例8: test_construct_arguments_does_not_raise_for_missing_defaults
def test_construct_arguments_does_not_raise_for_missing_defaults():
s = Signature(complex_function_name)
s.construct_arguments([], {}, {})
示例9: test_construct_arguments_does_not_raise_if_all_args_filled
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}, {})
示例10: test_construct_arguments_overwrites_defaults
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}
示例11: test_construct_arguments_does_not_overwrite_args_and_kwargs
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}
示例12: test_construct_arguments_ignores_excess_options
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}
示例13: test_construct_arguments_with_kwargs_for_posargs_does_not_raise
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}, {})
示例14: test_construct_arguments_with_expected_kwargs_does_not_raise
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}, {})
示例15: test_construct_arguments_without_duplicates_passes
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}, {})