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


Python TestCase.assertIsNotNone方法代码示例

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


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

示例1: _apply

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNotNone [as 别名]
 def _apply(self,
            put: unittest.TestCase,
            value: Any,
            message_builder: MessageBuilder):
     msg = message_builder.apply('')
     put.assertIsNotNone(value, msg)
     put.assertIsInstance(value, self.expected_type, msg)
     self.value_assertion.apply(put, value, message_builder)
开发者ID:emilkarlen,项目名称:exactly,代码行数:10,代码来源:value_assertion.py

示例2: _assertions

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNotNone [as 别名]
 def _assertions(self,
                 unittest_case: unittest.TestCase,
                 actual: FailureInfo):
     unittest_case.assertIsNotNone(actual,
                                   'Failure info should be present')
     unittest_case.assertIsInstance(actual, PhaseFailureInfo,
                                    'The failure is expected to be a {}'.format(str(PhaseFailureInfo)))
     assert isinstance(actual, PhaseFailureInfo)
     self.assertions_(unittest_case,
                      actual.phase_step.simple,
                      actual.failure_details)
开发者ID:emilkarlen,项目名称:exactly,代码行数:13,代码来源:failure_info_check.py

示例3: create_app

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNotNone [as 别名]
def create_app(test: unittest.TestCase) -> App:
    """
    Create an :py:class:`App <arobito.controlinterface.ControllerBackend.App>` instance

    :param test: The currently running unit test case
    :return: An instance of App
    """

    app = App()
    test.assertIsNotNone(app)
    test.assertIsInstance(app, App)
    return app
开发者ID:arobito,项目名称:arobito,代码行数:14,代码来源:ControllerBackend.py

示例4: check_result

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNotNone [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')
开发者ID:emilkarlen,项目名称:exactly,代码行数:17,代码来源:matcher_helpers.py

示例5: _assertions

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNotNone [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')
开发者ID:emilkarlen,项目名称:exactly,代码行数:22,代码来源:failure_assertions.py

示例6: get_valid_key

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNotNone [as 别名]
def get_valid_key(test: unittest.TestCase, app: App=None) -> str:
    """
    Produce a valid key by using the arobito default credentials against the :py:meth:`App.auth
    <arobito.controlinterface.ControllerBackend.App.auth>` method

    :param test: The currently running unit test case
    :return: A valid key
    """
    if app is None:
        app = create_app(test)

    request_valid = dict(username='arobito', password='arobito')
    response = app.auth(request_valid)
    test.assertIsNotNone(response, 'Response is none')
    test.assertIsInstance(response, dict, 'Response is not a dict')
    test.assertIn('auth', response, 'Response does not contain an auth element')
    auth = response['auth']
    test.assertIn('key', auth, 'Auth object does not contain a key')
    key = auth['key']
    test.assertIsNotNone(key, 'Key is None')
    test.assertIsInstance(key, str, 'Key is not a String')
    test.assertRegex(key, '^[a-zA-Z0-9]{64}$', 'Key looks not like expected')
    return key
开发者ID:arobito,项目名称:arobito,代码行数:25,代码来源:ControllerBackend.py

示例7: assert_velocity_properties

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNotNone [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))
开发者ID:SCECcode,项目名称:UCVM,代码行数:22,代码来源:test.py

示例8: assertIsNotNone

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertIsNotNone [as 别名]
    def assertIsNotNone(self, obj, msg=None):
        if hasattr(TestCase, 'assertIsNotNone'):
            return TestCase.assertIsNotNone(self, obj, msg)

        return self.assertTrue(obj is not None)
开发者ID:kiik,项目名称:flask-security,代码行数:7,代码来源:__init__.py


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