本文整理汇总了Python中unittest.TestCase.assertFalse方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.assertFalse方法的具体用法?Python TestCase.assertFalse怎么用?Python TestCase.assertFalse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestCase
的用法示例。
在下文中一共展示了TestCase.assertFalse方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hideHud
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def test_hideHud(self):
self.game.showHud('playerHud')
TestCase.assertTrue(self,
self.game.tilemap.layers['playerHud'].visible)
self.game.hideHud('playerHud')
TestCase.assertFalse(self,
self.game.tilemap.layers['playerHud'].visible)
示例2: check_both_single_and_multiple_line_source
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def check_both_single_and_multiple_line_source(
self,
put: unittest.TestCase,
first_source_line_instruction_argument_source_template: str,
act_phase_source_lines: list,
expected_cmd_and_args: ValueAssertion,
hds_contents: home_populators.HomePopulator = home_populators.empty()):
instruction_argument_source = first_source_line_instruction_argument_source_template.format_map(
self.format_map_for_template_string)
for source, source_assertion in equivalent_source_variants_with_assertion(put, instruction_argument_source):
# ARRANGE #
os_process_executor = AtcOsProcessExecutorThatRecordsArguments()
arrangement = Arrangement(source,
act_phase_source_lines,
atc_os_process_executor=os_process_executor,
hds_contents=hds_contents)
expectation = Expectation(source_after_parse=source_assertion)
# ACT #
check(put, arrangement, expectation)
# ASSERT #
put.assertFalse(os_process_executor.command.shell,
'Command should not indicate shell execution')
actual_cmd_and_args = os_process_executor.command.args
put.assertIsInstance(actual_cmd_and_args, list,
'Arguments of command to execute should be a list of arguments')
put.assertTrue(len(actual_cmd_and_args) > 0,
'List of arguments is expected to contain at least the file|interpreter argument')
expected_cmd_and_args.apply_with_message(put, actual_cmd_and_args, 'actual_cmd_and_args')
示例3: _apply
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def _apply(self,
put: unittest.TestCase,
value,
message_builder: asrt.MessageBuilder):
put.assertIsInstance(value, spe.ResultAndStderr)
put.assertFalse(value.result.is_success,
message_builder.apply('Result is expected to indicate failure'))
示例4: _apply
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def _apply(self,
put: unittest.TestCase,
value: T,
message_builder: MessageBuilder = MessageBuilder()):
msg = message_builder.apply(self.message)
if self.expected:
put.assertTrue(value, msg)
else:
put.assertFalse(value, msg)
示例5: _assert_source_is_not_at_eof_and_has_current_whole_line
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def _assert_source_is_not_at_eof_and_has_current_whole_line(put: unittest.TestCase,
source: ParseSource,
expected_current_line: str):
put.assertTrue(source.has_current_line,
'There should be remaining lines in the source')
put.assertFalse(source.is_at_eof,
'There should be remaining source')
put.assertEqual(expected_current_line,
source.current_line_text,
'Should should have given current line')
put.assertEqual(expected_current_line,
source.remaining_part_of_current_line,
'Current line should be identical to remaining-part-of-current-line')
示例6: _apply
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def _apply(self,
put: unittest.TestCase,
actual: Pattern,
message_builder: MessageBuilder):
put.assertEqual(self.pattern_string,
actual.pattern,
'regex pattern string')
for matching_string in self.matching_string_list:
put.assertTrue(bool(actual.search(matching_string)),
'reg-ex should match "{}"'.format(matching_string))
put.assertFalse(bool(actual.search(self.non_matching_string)),
'reg-ex should not match "{}"'.format(self.non_matching_string))
示例7: _apply
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def _apply(self,
put: unittest.TestCase,
value,
message_builder: asrt.MessageBuilder):
put.assertIsInstance(value, SymbolStringFragmentResolver)
assert isinstance(value, SymbolStringFragmentResolver) # Type info for IDE
put.assertFalse(value.is_string_constant,
'is_string_constant')
put.assertEqual(self.expected.symbol_name,
value.symbol_name,
'symbol_name')
示例8: log_dir_is_correct_for_each_phase
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def log_dir_is_correct_for_each_phase(recordings: dict,
put: unittest.TestCase,
actual: Result):
put.assertFalse(actual.partial_result.is_failure)
sds = actual.sds
expected = {
PhaseEnum.SETUP: sds_log_phase_dir(sds, phase_identifier.SETUP.identifier),
PhaseEnum.BEFORE_ASSERT: sds_log_phase_dir(sds, phase_identifier.BEFORE_ASSERT.identifier),
PhaseEnum.ASSERT: sds_log_phase_dir(sds, phase_identifier.ASSERT.identifier),
PhaseEnum.CLEANUP: sds_log_phase_dir(sds, phase_identifier.CLEANUP.identifier),
}
put.assertDictEqual(expected,
recordings,
'Log directory per phase')
示例9: assert_equal_failure_details
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def assert_equal_failure_details(unit_tc: unittest.TestCase,
expected: FailureDetails,
actual: FailureDetails):
if expected.is_only_failure_message:
unit_tc.assertTrue(actual.is_only_failure_message,
'An error message is expected')
unit_tc.assertEqual(expected.failure_message,
actual.failure_message,
'The failure message should be the expected')
else:
unit_tc.assertFalse(actual.is_only_failure_message,
'An exception is expected')
unit_tc.assertEqual(expected.exception,
actual.exception,
'The exception should be the expected')
示例10: _expect_string
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [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)
示例11: _expect_here_doc
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [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)
示例12: _assert_source_is_at_end
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def _assert_source_is_at_end(put: unittest.TestCase, source: ParseSource):
put.assertFalse(source.has_current_line,
'There should be no remaining lines in the source')
put.assertTrue(source.is_at_eof,
'There should be no remaining data in the source')
示例13: _apply
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def _apply(self,
put: unittest.TestCase,
value: pathlib.Path,
message_builder: MessageBuilder):
put.assertFalse(value.exists(),
message_builder.msg_for_sub_component('exists'))
示例14: assert_is_not_null
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertFalse [as 别名]
def assert_is_not_null(put: unittest.TestCase, actual: sut.TokenStream):
put.assertFalse(actual.is_null,
'is null')
put.assertIsNot(LookAheadState.NULL,
actual.look_ahead_state,
'look ahead state')