当前位置: 首页>>代码示例>>Python>>正文


Python validity_matcher.is_invalid_with_message函数代码示例

本文整理汇总了Python中tests.support.validity_matcher.is_invalid_with_message函数的典型用法代码示例。如果您正苦于以下问题:Python is_invalid_with_message函数的具体用法?Python is_invalid_with_message怎么用?Python is_invalid_with_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_invalid_with_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_queries_with_period_values_must_be_certain_values

    def test_queries_with_period_values_must_be_certain_values(self):
        validation_result = validate_request_args({
            'period': 'fortnight'
        })

        assert_that(validation_result, is_invalid_with_message(
            "'period' must be one of ['hour', 'day', 'week', 'month']"))
开发者ID:frabcus,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例2: test_queries_with_unrecognized_sort_by_values_are_disallowed

 def test_queries_with_unrecognized_sort_by_values_are_disallowed(self):
     validation_result = validate_request_args({
         'sort_by': 'foo:random',
     })
     assert_that( validation_result, is_invalid_with_message(
         'Unrecognised sort direction. Supported directions '
         'include: ascending, descending') )
开发者ID:NRCan,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例3: test_queries_with_collect_and_no_group_by_are_disallowed

 def test_queries_with_collect_and_no_group_by_are_disallowed(self):
     validation_result_without_group_by = validate_request_args(MultiDict([
         ("collect", 'foo')
     ]))
     assert_that(validation_result_without_group_by,
                 is_invalid_with_message(
                     'collect can be use only with group_by'))
开发者ID:roc,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例4: test_just_end_at_isnt_allowed

    def test_just_end_at_isnt_allowed(self):
        validation_result = validate_request_args({
            'end_at': '2000-02-02T00:00:00+00:00',
        })

        assert_that(validation_result, is_invalid_with_message(
            "Use of 'end_at' requires 'start_at' or 'duration'"))
开发者ID:NRCan,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例5: test_filter_by_prefix_with_invalid_field_names_is_disallowed

 def test_filter_by_prefix_with_invalid_field_names_is_disallowed(self):
     validation_result = validate_request_args({
         'filter_by_prefix': 'with-hyphen:bar'
     })
     assert_that(validation_result, is_invalid_with_message(
         'Cannot filter by an invalid field name'
     ))
开发者ID:NRCan,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例6: test_queries_sorting_by_invalid_field_names_are_disallowed

 def test_queries_sorting_by_invalid_field_names_are_disallowed(self):
     validation_result = validate_request_args({
         'sort_by': 'with-hyphen:ascending'
     })
     assert_that(validation_result, is_invalid_with_message(
         'Cannot sort by an invalid field name'
     ))
开发者ID:NRCan,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例7: test_queries_with_grouping_on_internal_fields_are_disallowed

 def test_queries_with_grouping_on_internal_fields_are_disallowed(self):
     validation_result = validate_request_args({
         "group_by": "_internal"
     })
     assert_that(validation_result, is_invalid_with_message(
         "Cannot group by internal fields, internal fields "
         "start with an underscore"))
开发者ID:NRCan,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例8: test_objects_with_unrecognised_internal_keys_are_disallowed

 def test_objects_with_unrecognised_internal_keys_are_disallowed(self):
     validation_result = validate_record_data({
         '_unknown': 'whatever'
     })
     assert_that(validation_result,
                 is_invalid_with_message(
                     "_unknown is not a recognised internal field"))
开发者ID:pwaller,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例9: test_objects_with_invalid_timestamps_are_disallowed

 def test_objects_with_invalid_timestamps_are_disallowed(self):
     validation_result = validate_record_data({
         '_timestamp': 'this is not a timestamp'
     })
     assert_that(validation_result,
                 is_invalid_with_message(
                     "_timestamp is not a valid datetime object"))
开发者ID:pwaller,项目名称:backdrop,代码行数:7,代码来源:test_validation.py

示例10: test_that_queries_with_invalid_timezone_are_disallowed

    def test_that_queries_with_invalid_timezone_are_disallowed(self):
        validation_result = validate_request_args({
            'start_at': '2013-01-01T00:00:00+24:00',
            'end_at': '2013-01-08T00:00:00+24:00'
        })

        assert_that(validation_result, is_invalid_with_message(
            "start_at is not a valid datetime"))
开发者ID:NRCan,项目名称:backdrop,代码行数:8,代码来源:test_validation.py

示例11: test_queries_with_non_existent_dates_are_disallowed

    def test_queries_with_non_existent_dates_are_disallowed(self):
        validation_result = validate_request_args({
            'start_at': '2013-13-70T00:00:00Z',
            'end_at': '2013-12-70T00:00:00Z'
        })

        assert_that(validation_result, is_invalid_with_message(
            "start_at is not a valid datetime"))
开发者ID:NRCan,项目名称:backdrop,代码行数:8,代码来源:test_validation.py

示例12: test_queries_with_sort_by_and_period_are_disallowed

 def test_queries_with_sort_by_and_period_are_disallowed(self):
     validation_result = validate_request_args({
         "sort_by": "foo:ascending",
         "period": "week"
     })
     assert_that( validation_result, is_invalid_with_message(
         "Cannot sort for period queries without group_by. "
         "Period queries are always sorted by time.") )
开发者ID:frabcus,项目名称:backdrop,代码行数:8,代码来源:test_validation.py

示例13: test_queries_grouping_and_collecting_equal_fields_are_disallowed

 def test_queries_grouping_and_collecting_equal_fields_are_disallowed(self):
     validation_result_without_group_by = validate_request_args(MultiDict([
         ("group_by", 'a_field'),
         ("collect", 'a_field')
     ]))
     assert_that(validation_result_without_group_by,
                 is_invalid_with_message(
                     "Cannot collect by a field that is used for group_by"))
开发者ID:NRCan,项目名称:backdrop,代码行数:8,代码来源:test_validation.py

示例14: test_queries_collecting_invalid_field_names_are_disallowed

 def test_queries_collecting_invalid_field_names_are_disallowed(self):
     validation_result = validate_request_args(MultiDict([
         ("group_by", "bar"),
         ("collect", "with-hyphen")
     ]))
     assert_that(validation_result, is_invalid_with_message(
         "Cannot collect an invalid field name"
     ))
开发者ID:NRCan,项目名称:backdrop,代码行数:8,代码来源:test_validation.py

示例15: test_that_end_at_with_time_other_than_midnight_is_disallowed

 def test_that_end_at_with_time_other_than_midnight_is_disallowed(self):
     validation_result = validate_request_args({
         'group_by': 'some_key',
         'start_at': '2013-04-01T00:00:00Z',
         'end_at': '2013-04-08T00:00:01Z'
     })
     assert_that(validation_result, is_invalid_with_message(
         'end_at must be midnight'))
开发者ID:frabcus,项目名称:backdrop,代码行数:8,代码来源:test_validation_of_queries_accessing_raw_data.py


注:本文中的tests.support.validity_matcher.is_invalid_with_message函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。