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


Python TestCase.assertIs方法代码示例

本文整理汇总了Python中unittest.TestCase.assertIs方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.assertIs方法的具体用法?Python TestCase.assertIs怎么用?Python TestCase.assertIs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unittest.TestCase的用法示例。


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

示例1: assert_contents_and_that_last_child_is_returned

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
def assert_contents_and_that_last_child_is_returned(
        expected_xml: str,
        root: Element,
        ret_val_from_renderer: Element,
        put: unittest.TestCase):
    xml_string = as_unicode_str(root)
    put.assertEqual(expected_xml,
                    xml_string)
    put.assertIs(list(root)[-1],
                 ret_val_from_renderer)
开发者ID:emilkarlen,项目名称:exactly,代码行数:12,代码来源:test_resources.py

示例2: _assert_table_contains

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
def _assert_table_contains(put: unittest.TestCase,
                           table: sut.SymbolTable,
                           expected_symbol: NameAndValue):
    put.assertTrue(table.contains(expected_symbol.name),
                   'table SHOULD contain the value')
    put.assertIn(expected_symbol.name,
                 table.names_set,
                 'names set should contain the value')
    put.assertIs(expected_symbol.value,
                 table.lookup(expected_symbol.name),
                 'lookup should fins the value')
开发者ID:emilkarlen,项目名称:exactly,代码行数:13,代码来源:symbol_table.py

示例3: check

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
 def check(self,
           put: unittest.TestCase,
           sr: reporting.SubSuiteReporter,
           msg_header=''):
     progress_reporter = sr.progress_reporter
     assert isinstance(progress_reporter, ExecutionTracingSubSuiteProgressReporter)
     put.assertIs(self.suite,
                  progress_reporter.sub_suite,
                  msg_header + 'Suite instance')
     put.assertEqual(len(self.case_and_result_status_list),
                     len(progress_reporter.case_begin_list),
                     msg_header + 'Number of invocations of case-begin')
     self._assert_correct_progress_reporter_invocations(progress_reporter, msg_header, put)
     self._assert_correct_sub_suite_reporter_invocations(sr, msg_header, put)
开发者ID:emilkarlen,项目名称:exactly,代码行数:16,代码来源:basic_scenarios.py

示例4: _apply

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
 def _apply(self,
            put: unittest.TestCase,
            value,
            message_builder: asrt.MessageBuilder):
     put.assertIsInstance(value, DataValueResolver)
     assert isinstance(value, DataValueResolver)
     put.assertEqual(TypeCategory.DATA,
                     value.type_category,
                     _ELEMENT_TYPE_ERROR_MESSAGE)
     put.assertIs(self.expected.data_value_type,
                  value.data_value_type,
                  'data_value_type')
     put.assertIs(self.expected.value_type,
                  value.value_type,
                  'value_type')
     _EqualsDataValueResolverVisitor(value, put, message_builder).visit(self.expected)
开发者ID:emilkarlen,项目名称:exactly,代码行数:18,代码来源:any_resolver_assertions.py

示例5: _expect_string

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
def _expect_string(put: unittest.TestCase,
                   source: ParseSource,
                   expectation: ExpectedString):
    # ACT #
    actual = sut.parse_from_parse_source(source)
    # ASSERT #
    put.assertIs(string_or_file.SourceType.STRING,
                 actual.source_type,
                 'source type')
    put.assertFalse(actual.is_file_ref,
                    'is_file_ref')
    assertion_on_here_doc = asrt_string.matches_primitive_string(asrt.equals(expectation.resolved_str),
                                                                 expectation.common.symbol_references,
                                                                 expectation.common.symbol_table)
    assertion_on_here_doc.apply_with_message(put, actual.string_resolver,
                                             'string_resolver')
    _expect_common(put, source, actual,
                   expectation.common)
开发者ID:emilkarlen,项目名称:exactly,代码行数:20,代码来源:parse_here_doc_or_file_ref.py

示例6: _expect_here_doc

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
def _expect_here_doc(put: unittest.TestCase,
                     source: ParseSource,
                     expectation: ExpectedHereDoc):
    # ACT #
    actual = sut.parse_from_parse_source(source)
    # ASSERT #
    put.assertIs(string_or_file.SourceType.HERE_DOC,
                 actual.source_type,
                 'source type')
    put.assertFalse(actual.is_file_ref,
                    'is_file_ref')
    assertion_on_here_doc = asrt_hd.matches_resolved_value(expectation.resolved_here_doc_lines,
                                                           expectation.common.symbol_references,
                                                           expectation.common.symbol_table)
    assertion_on_here_doc.apply_with_message(put, actual.string_resolver,
                                             'here_document')
    _expect_common(put, source, actual,
                   expectation.common)
开发者ID:emilkarlen,项目名称:exactly,代码行数:20,代码来源:parse_here_doc_or_file_ref.py

示例7: _expect_file_ref

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
def _expect_file_ref(put: unittest.TestCase,
                     source: ParseSource,
                     expectation: ExpectedFileRef,
                     rel_opt_arg_conf: RelOptionArgumentConfiguration = sut.CONFIGURATION,
                     ):
    # ACT #
    actual = sut.parse_from_parse_source(source, rel_opt_arg_conf)
    # ASSERT #
    put.assertIs(string_or_file.SourceType.PATH,
                 actual.source_type,
                 'source type')
    put.assertTrue(actual.is_file_ref,
                   'is_file_ref')
    symbol_references_assertion = equals_symbol_references(expectation.common.symbol_references)
    expected_file_ref_resolver = matches_file_ref_resolver(expectation.file_ref_value,
                                                           symbol_references_assertion,
                                                           symbol_table=expectation.common.symbol_table)
    expected_file_ref_resolver.apply_with_message(put, actual.file_reference_resolver,
                                                  'file_reference_resolver')
    _expect_common(put, source, actual,
                   expectation.common)
开发者ID:emilkarlen,项目名称:exactly,代码行数:23,代码来源:parse_here_doc_or_file_ref.py

示例8: _check_invokation_sequence

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
 def _check_invokation_sequence(self,
                                put: unittest.TestCase,
                                sr: ExecutionTracingSubSuiteProgressReporter,
                                msg_header=''):
     expected_num_cases = len(self.case_and_result_status_list)
     actual_num_events = len(sr.event_type_list)
     expected_num_events = 2 + 2 * expected_num_cases
     put.assertEqual(expected_num_events,
                     actual_num_events,
                     msg_header + 'Total number of events')
     put.assertIs(EventType.SUITE_BEGIN,
                  sr.event_type_list[0],
                  msg_header + 'First event should be ' + str(EventType.SUITE_BEGIN))
     put.assertIs(EventType.SUITE_END,
                  sr.event_type_list[-1],
                  msg_header + 'Last event should be ' + str(EventType.SUITE_END))
     for case_idx in range(1, 1 + 2 * expected_num_cases, 2):
         put.assertIs(EventType.CASE_BEGIN,
                      sr.event_type_list[case_idx],
                      msg_header + 'First event of case processing')
         put.assertIs(EventType.CASE_END,
                      sr.event_type_list[case_idx + 1],
                      msg_header + 'Second event of case processing')
开发者ID:emilkarlen,项目名称:exactly,代码行数:25,代码来源:basic_scenarios.py

示例9: _apply

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
 def _apply(self,
            put: unittest.TestCase,
            value: T,
            message_builder: MessageBuilder):
     put.assertIs(self.expected, value,
                  message_builder.apply(self.message))
开发者ID:emilkarlen,项目名称:exactly,代码行数:8,代码来源:value_assertion.py

示例10: assert_is_null

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIs [as 别名]
def assert_is_null(put: unittest.TestCase, actual: sut.TokenStream):
    put.assertTrue(actual.is_null,
                   'is null')
    put.assertIs(LookAheadState.NULL,
                 actual.look_ahead_state,
                 'look ahead state')
开发者ID:emilkarlen,项目名称:exactly,代码行数:8,代码来源:token_stream.py


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