本文整理汇总了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}
开发者ID:IDSIA,项目名称:sacred,代码行数:9,代码来源:test_signature_py3.py
示例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], {}) == []
开发者ID:IDSIA,项目名称:sacred,代码行数:11,代码来源:test_signature.py
示例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}, {})
开发者ID:IDSIA,项目名称:sacred,代码行数:9,代码来源:test_signature.py
示例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])
开发者ID:IDSIA,项目名称:sacred,代码行数:14,代码来源:test_signature.py
示例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])
开发者ID:IDSIA,项目名称:sacred,代码行数:15,代码来源:test_signature.py
示例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}
开发者ID:IDSIA,项目名称:sacred,代码行数:20,代码来源:test_signature.py
示例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}
开发者ID:IDSIA,项目名称:sacred,代码行数:5,代码来源:test_signature.py
示例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([], {}, {})
开发者ID:IDSIA,项目名称:sacred,代码行数:3,代码来源:test_signature.py
示例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}, {})
开发者ID:IDSIA,项目名称:sacred,代码行数:6,代码来源:test_signature.py
示例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}
开发者ID:IDSIA,项目名称:sacred,代码行数:5,代码来源:test_signature.py
示例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}
开发者ID:IDSIA,项目名称:sacred,代码行数:6,代码来源:test_signature.py
示例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}
开发者ID:IDSIA,项目名称:sacred,代码行数:6,代码来源:test_signature.py
示例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}, {})
开发者ID:IDSIA,项目名称:sacred,代码行数:4,代码来源:test_signature.py
示例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}, {})
开发者ID:IDSIA,项目名称:sacred,代码行数:5,代码来源:test_signature.py
示例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}, {})
开发者ID:IDSIA,项目名称:sacred,代码行数:6,代码来源:test_signature_py3.py
注:本文中的sacred.config.signature.Signature类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论