本文整理汇总了Python中tests.utils.assert_path_not_in_errors函数的典型用法代码示例。如果您正苦于以下问题:Python assert_path_not_in_errors函数的具体用法?Python assert_path_not_in_errors怎么用?Python assert_path_not_in_errors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_path_not_in_errors函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_field_declared_as_required_with_field_present_is_valid
def test_field_declared_as_required_with_field_present_is_valid():
schema = {
'type': OBJECT,
'required': [
'field-A',
# 'field-B',
],
}
validator = generate_validator_from_schema(schema)
try:
validator({'field-A': 'present'})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors(
'required.field-A',
errors,
)
assert_path_not_in_errors(
'required.field-B',
errors,
)
开发者ID:Arable,项目名称:flex,代码行数:25,代码来源:test_required_validation.py
示例2: test_format_for_valid_unregistered_format
def test_format_for_valid_unregistered_format():
try:
schema_validator({'format': 'not-a-registered-format'})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('format', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_format.py
示例3: test_collection_format_is_not_required
def test_collection_format_is_not_required():
try:
single_parameter_validator({})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors("collectionFormat", errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_collection_format.py
示例4: test_collection_format_with_valid_values
def test_collection_format_with_valid_values():
try:
single_parameter_validator({"collectionFormat": CSV})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors("collectionFormat", errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_collection_format.py
示例5: test_unique_items_with_valid_value
def test_unique_items_with_valid_value():
try:
schema_validator({'uniqueItems': True})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('uniqueItems', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_unique_items.py
示例6: test_unique_items_are_not_required
def test_unique_items_are_not_required():
try:
schema_validator({})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('uniqueItems', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_unique_items.py
示例7: test_read_only_with_valid_value
def test_read_only_with_valid_value():
try:
schema_validator({'readOnly': True})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('readOnly', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_read_only.py
示例8: test_required_for_valid_required
def test_required_for_valid_required():
try:
schema_validator({'required': ['field-A', 'field-B']})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('required', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_required.py
示例9: test_pattern_for_valid_regex
def test_pattern_for_valid_regex():
try:
schema_validator({'pattern': '^test$'})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('pattern', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_pattern.py
示例10: test_title_for_valid_title
def test_title_for_valid_title():
try:
schema_validator({'title': 'uuid'})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('title', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_title.py
示例11: test_type_validation_for_multiple_of_for_valid_types
def test_type_validation_for_multiple_of_for_valid_types(type_):
try:
schema_validator({"multipleOf": 5, "type": type_})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors("type", errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_multiple_of_validation.py
示例12: test_type_is_not_required
def test_type_is_not_required():
try:
single_parameter_validator({})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('type', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_type_validation.py
示例13: test_enum_with_empty_array_is_invalid
def test_enum_with_empty_array_is_invalid():
try:
schema_validator({'enum': [1, 2, 3]})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('enum', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_enum.py
示例14: test_headers_validation_with_valid_type
def test_headers_validation_with_valid_type():
try:
single_response_validator({'headers': {}})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('headers', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_multi_header_validation.py
示例15: test_multiple_for_valid_values
def test_multiple_for_valid_values(value):
try:
schema_validator({"multipleOf": value})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors("multipleOf", errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_multiple_of_validation.py
示例16: test_read_only_is_not_required
def test_read_only_is_not_required():
try:
schema_validator({})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('readOnly', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_read_only.py
示例17: test_headers_is_not_required
def test_headers_is_not_required():
try:
single_response_validator({})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('headers', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_multi_header_validation.py
示例18: test_properties_is_not_required
def test_properties_is_not_required():
try:
schema_validator({})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors('properties', errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_properties.py
示例19: test_multiple_of_is_not_required
def test_multiple_of_is_not_required():
try:
schema_validator({})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors("multipleOf", errors)
开发者ID:Arable,项目名称:flex,代码行数:9,代码来源:test_multiple_of_validation.py
示例20: test_min_and_max_length_with_valid_values
def test_min_and_max_length_with_valid_values():
try:
schema_validator({"minLength": 8, "maxLength": 10})
except ValidationError as err:
errors = err.detail
else:
errors = {}
assert_path_not_in_errors("minLength", errors)
assert_path_not_in_errors("maxLength", errors)
开发者ID:Arable,项目名称:flex,代码行数:10,代码来源:test_min_and_max_length.py
注:本文中的tests.utils.assert_path_not_in_errors函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论