本文整理汇总了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)
示例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')
示例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)
示例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)
示例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)
示例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)
示例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)
示例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')
示例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))
示例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')