本文整理汇总了Python中unittest.TestCase.assertIsNone方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.assertIsNone方法的具体用法?Python TestCase.assertIsNone怎么用?Python TestCase.assertIsNone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestCase
的用法示例。
在下文中一共展示了TestCase.assertIsNone方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _apply
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNone [as 别名]
def _apply(self,
put: unittest.TestCase,
value,
message_builder: asrt.MessageBuilder):
model = value
assert isinstance(model, SettingsBuilderAssertionModel) # Type info for IDE
put.assertIsNone(model.actual.stdin.file_name,
message_builder.apply('file name should not be set when using here doc'))
expected_contents_str = self.expected_contents_resolver.resolve_value_of_any_dependency(
model.environment.path_resolving_environment_pre_or_post_sds)
put.assertEqual(expected_contents_str,
model.actual.stdin.contents,
message_builder.apply('stdin as contents'))
示例2: check_result
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNone [as 别名]
def check_result(put: unittest.TestCase,
environment: InstructionEnvironmentForPostSdsStep,
expected_matcher_result: Optional[ValueAssertion[str]],
actual_result: Optional[ErrorMessageResolver]):
if expected_matcher_result is None:
put.assertIsNone(actual_result,
'result from main')
else:
put.assertIsNotNone(actual_result,
'result from main')
err_msg_env = ErrorMessageResolvingEnvironment(environment.home_and_sds,
environment.symbols)
err_msg = actual_result.resolve(err_msg_env)
expected_matcher_result.apply_with_message(put, err_msg,
'error result of main')
示例3: assertions
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNone [as 别名]
def assertions(self,
put: unittest.TestCase,
actual: FailureDetails,
message_header: str = None):
message_builder = asrt.new_message_builder(message_header)
if self.error_message_or_none is None and self.exception_class_or_none is None:
put.assertIsNone(actual,
message_header)
elif self.error_message_or_none is not None:
self.error_message_or_none.apply(put,
actual.failure_message,
message_builder.for_sub_component('failure message'))
else:
put.assertIsInstance(actual.exception,
self.exception_class_or_none,
message_builder.for_sub_component('exception class'))
示例4: _assertions
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNone [as 别名]
def _assertions(self,
unittest_case: unittest.TestCase,
return_value: Failure):
if self._status is PartialExeResultStatus.PASS:
unittest_case.assertIsNone(return_value,
'Return value must be None (representing success)')
else:
unittest_case.assertIsNotNone(return_value,
'Return value must not be None (representing failure)')
unittest_case.assertEqual(self._status,
return_value.status,
'Status')
self._line.apply_with_message(unittest_case,
return_value.source_location,
'source location path')
unittest_case.assertIsNotNone(return_value.failure_details,
'failure_details must be present')
self._failure_details.apply_with_message(unittest_case,
return_value.failure_details,
'failure_details')
示例5: assert_velocity_properties
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNone [as 别名]
def assert_velocity_properties(test_case: unittest.TestCase, data: SeismicData,
velocity_prop: VelocityProperties) -> None:
test_case.assertIsNotNone(data)
test_case.assertIsNotNone(data.velocity_properties)
test_case.assertIsNotNone(velocity_prop)
for prop in dir(data.velocity_properties):
if "_" in prop[0:1] or prop == "count" or prop == "index":
continue
if getattr(data.velocity_properties, prop) is None:
test_case.assertIsNone(getattr(velocity_prop, prop))
else:
try:
float(getattr(data.velocity_properties, prop))
test_case.assertAlmostEqual(getattr(data.velocity_properties, prop),
getattr(velocity_prop, prop), 3)
except ValueError:
test_case.assertEqual(getattr(data.velocity_properties, prop),
getattr(velocity_prop, prop))
示例6: _assertions
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNone [as 别名]
def _assertions(self,
unittest_case: unittest.TestCase,
actual_failure_info: FailureInfo):
unittest_case.assertIsNone(actual_failure_info,
'There should be no failure')
示例7: _apply
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNone [as 别名]
def _apply(self,
put: unittest.TestCase,
value: T,
message_builder: MessageBuilder):
put.assertIsNone(value,
message_builder.apply(self.message))