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


Python TestCase.assertEqual方法代码示例

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


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

示例1: check

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
 def check(self, tc, exp_log, cachedMsg):
     exp_level, exp_msgs = exp_log
     act_msgs = cachedMsg[1:]
     if exp_level is 'INFO':
         TestCase.assertEqual(tc, exp_msgs, act_msgs)
     if exp_level is 'ERROR':
         pass  #
开发者ID:claude-lee,项目名称:saymeando,代码行数:9,代码来源:testHelper.py

示例2: test_enumJointLabelings

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
 def test_enumJointLabelings(self):
     #print nx.maximal_matching(self.graph)
     #print nx.max_weight_matching(self.graph)
     joint,first = SR.enumJointLabelings([self.graph])
     TestCase.assertEqual(self,len(joint[self.graph]),15)
     valid, validAtNode = SR.validLabels(joint,first)
     TestCase.assertEqual(self,len(valid[self.graph]),8)
开发者ID:nluhmann,项目名称:PhySca,代码行数:9,代码来源:test_SR.py

示例3: _check_existence

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
 def _check_existence(self,
                      put: unittest.TestCase,
                      actual: DirDependentValue,
                      message_builder: asrt.MessageBuilder):
     put.assertEqual(self._expected.exists_pre_sds(),
                     actual.exists_pre_sds(),
                     message_builder.apply('exists_pre_sds'))
开发者ID:emilkarlen,项目名称:exactly,代码行数:9,代码来源:dir_dependent_value.py

示例4: _apply

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
    def _apply(self,
               put: unittest.TestCase,
               value,
               message_builder: asrt.MessageBuilder):
        put.assertIsInstance(value, rs.SymbolTable)
        assert isinstance(value, rs.SymbolTable)
        put.assertEqual(self.expected.names_set,
                        value.names_set,
                        message_builder.apply('names in symbol table'))
        for name in self.expected.names_set:
            actual_value = value.lookup(name)

            put.assertIsInstance(actual_value, rs.SymbolContainer,
                                 message_builder.apply('actual container for ' + name))
            assert isinstance(actual_value, rs.SymbolContainer)

            expected_container = self.expected.lookup(name)

            put.assertIsInstance(expected_container, rs.SymbolContainer,
                                 message_builder.apply('expected container for ' + name))
            assert isinstance(expected_container, rs.SymbolContainer)

            equals_container(expected_container).apply(put,
                                                       actual_value,
                                                       message_builder.for_sub_component('Value of symbol ' + name))
开发者ID:emilkarlen,项目名称:exactly,代码行数:27,代码来源:symbol_structure_assertions.py

示例5: _check_sub_class_properties

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
    def _check_sub_class_properties(self,
                                    put: unittest.TestCase,
                                    actual: DirDependentValue,
                                    tcds: HomeAndSds,
                                    message_builder: asrt.MessageBuilder):
        put.assertIsInstance(actual,
                             SingleDirDependentValue,
                             message_builder.apply('class'))
        assert isinstance(actual, SingleDirDependentValue)  # Type info for IDE

        put.assertEqual(self._resolving_dependency,
                        actual.resolving_dependency(),
                        message_builder.apply('resolving_dependency'))

        assertion_on_resolved_value = self.resolved_value(tcds)

        if not self._resolving_dependency or self._resolving_dependency == DirectoryStructurePartition.HOME:
            resolved_value_post_sds = actual.value_pre_sds(tcds.hds)
            assertion_on_resolved_value.apply(put,
                                              resolved_value_post_sds,
                                              message_builder.for_sub_component('value_pre_sds'))

        if not self._resolving_dependency or self._resolving_dependency == DirectoryStructurePartition.NON_HOME:
            resolved_value_post_sds = actual.value_post_sds(tcds.sds)
            assertion_on_resolved_value.apply(put,
                                              resolved_value_post_sds,
                                              message_builder.for_sub_component('value_pre_sds'))
开发者ID:emilkarlen,项目名称:exactly,代码行数:29,代码来源:dir_dep_value_assertions.py

示例6: get_printed_sds_or_fail

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
def get_printed_sds_or_fail(put: unittest.TestCase, actual: SubProcessResult) -> str:
    printed_lines = actual.stdout.splitlines()
    put.assertEqual(1,
                    len(printed_lines),
                    'Number of printed printed lines should be exactly 1')
    actual_sds_directory = printed_lines[0]
    return actual_sds_directory
开发者ID:emilkarlen,项目名称:exactly,代码行数:9,代码来源:utils.py

示例7: _apply

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

示例8: _assert_table_contains_single_value

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
def _assert_table_contains_single_value(put: unittest.TestCase,
                                        table: sut.SymbolTable,
                                        expected_symbol: NameAndValue):
    _assert_table_contains(put, table, expected_symbol)
    put.assertEqual({expected_symbol.name},
                    table.names_set,
                    'names set should contain a single value')
开发者ID:emilkarlen,项目名称:exactly,代码行数:9,代码来源:symbol_table.py

示例9: check

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
def check(put: unittest.TestCase,
          arrangement: Arrangement,
          expectation: Expectation):
    actor = ActorThatRecordsSteps(
        arrangement.test_case_generator.recorder,
        arrangement.actor)

    def action(std_files: StdOutputFiles) -> PartialExeResult:
        exe_conf = ExecutionConfiguration(dict(os.environ),
                                          DEFAULT_ATC_OS_PROCESS_EXECUTOR,
                                          sandbox_root_name_resolver.for_test(),
                                          exe_atc_and_skip_assertions=std_files)
        with home_directory_structure() as hds:
            conf_phase_values = ConfPhaseValues(actor,
                                                hds,
                                                timeout_in_seconds=arrangement.timeout_in_seconds)
            return sut.execute(arrangement.test_case_generator.test_case,
                               exe_conf,
                               conf_phase_values,
                               setup.default_settings(),
                               False,
                               )

    out_files, partial_result = capture_stdout_err(action)

    expectation.result.apply_with_message(put, partial_result,
                                          'partial result')
    put.assertEqual(expectation.step_recordings,
                    arrangement.test_case_generator.recorder.recorded_elements,
                    'steps')
    expectation.atc_stdout_output.apply_with_message(put, out_files.out,
                                                     'stdout')
    expectation.atc_stderr_output.apply_with_message(put, out_files.err,
                                                     'stderr')
开发者ID:emilkarlen,项目名称:exactly,代码行数:36,代码来源:action_to_check_output.py

示例10: _apply

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
 def _apply(self,
            put: unittest.TestCase,
            value: HomeAndSds,
            message_builder: asrt.MessageBuilder):
     relativity_root = REL_OPTIONS_MAP[self.relativity].root_resolver.from_home_and_sds(value)
     put.assertEqual(relativity_root / self.expected_sub_dir_of_act_dir,
                     pathlib.Path.cwd(),
                     message_builder.apply('CWD expected to be sub-dir of ' + str(self.relativity)))
开发者ID:emilkarlen,项目名称:exactly,代码行数:10,代码来源:side_effects.py

示例11: assertions

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
 def assertions(self,
                put: unittest.TestCase,
                reporter: ExecutionTracingRootSuiteReporter,
                actual_exit_code: int):
     put.assertEqual(ExecutionTracingRootSuiteReporter.VALID_SUITE_EXIT_CODE,
                     actual_exit_code,
                     'Expecting the suite be be valid (and thus to have been executed).')
     _assert_every_test_case_to_pass(put, reporter)
开发者ID:emilkarlen,项目名称:exactly,代码行数:10,代码来源:propagation_of_act_phase_setup_to_individual_test_cases.py

示例12: _apply

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
 def _apply(self,
            put: unittest.TestCase,
            value,
            message_builder: asrt.MessageBuilder):
     put.assertIsInstance(value, spe.ResultAndStderr)
     put.assertEqual(self.stderr_contents,
                     value.stderr_contents,
                     message_builder.apply('Stderr contents'))
开发者ID:emilkarlen,项目名称:exactly,代码行数:10,代码来源:sub_process_result_check.py

示例13: assert_coordinate_lists_equal

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
def assert_coordinate_lists_equal(coordinate_list: List[Coordinate],
                                  expected_coordinate_list: List[Coordinate],
                                  test_case: TestCase):
    test_case.assertEqual(len(list(coordinate_list)), len(list(expected_coordinate_list)))
    for coordinate, expected_coordinate in zip(coordinate_list, expected_coordinate_list):
        assert_coordinates_equal(coordinate=coordinate,
                                 expected_coordinate=expected_coordinate,
                                 test_case=test_case)
开发者ID:wileykestner,项目名称:minesweeper,代码行数:10,代码来源:__init__.py

示例14: _apply

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
 def _apply(self,
            put: unittest.TestCase,
            value: StringTransformerModel,
            message_builder: MessageBuilder):
     actual = len(list(value))
     put.assertEqual(self.expected_num_lines,
                     actual,
                     'number of lines')
开发者ID:emilkarlen,项目名称:exactly,代码行数:10,代码来源:integration_check.py

示例15: _check_indent

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEqual [as 别名]
def _check_indent(put: unittest.TestCase,
                  wrapper: sut.Wrapper,
                  expected_current_indent: sut.Indent,
                  expected_saved_stack: list):
    _check_current_indent(put, wrapper, expected_current_indent)
    put.assertEqual(expected_saved_stack,
                    wrapper.saved_indents_stack,
                    'Saved indent stack')
开发者ID:emilkarlen,项目名称:exactly,代码行数:10,代码来源:wrapper.py


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