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


Python ErrorInterface.get_error方法代码示例

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


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

示例1: test_get_error_zero

# 需要导入模块: from job.configuration.interface.error_interface import ErrorInterface [as 别名]
# 或者: from job.configuration.interface.error_interface.ErrorInterface import get_error [as 别名]
    def test_get_error_zero(self):
        """ Tests that no error is returned when the exit_code is 0"""

        error_interface_dict = {
            u"version": u"1.0",
            u"exit_codes": {u"1": self.error_1.name, u"2": self.error_2.name, u"3": self.error_3.name},
        }

        error_interface = ErrorInterface(error_interface_dict)
        error = error_interface.get_error(0)

        self.assertIsNone(error)
开发者ID:Carl4,项目名称:scale,代码行数:14,代码来源:test_error_interface.py

示例2: test_get_error_missing

# 需要导入模块: from job.configuration.interface.error_interface import ErrorInterface [as 别名]
# 或者: from job.configuration.interface.error_interface.ErrorInterface import get_error [as 别名]
    def test_get_error_missing(self):
        """ Tests that an unknown error is returned when a non-registered name is found in the mapping"""

        error_interface_dict = {
            u"version": u"1.0",
            u"exit_codes": {u"1": self.error_1.name, u"2": self.error_2.name, u"3": self.error_3.name},
        }

        error_interface = ErrorInterface(error_interface_dict)
        error = error_interface.get_error(4)

        self.assertIsNotNone(error)
        self.assertEqual(error.name, Error.objects.get_unknown_error().name)
开发者ID:Carl4,项目名称:scale,代码行数:15,代码来源:test_error_interface.py

示例3: test_get_error_found

# 需要导入模块: from job.configuration.interface.error_interface import ErrorInterface [as 别名]
# 或者: from job.configuration.interface.error_interface.ErrorInterface import get_error [as 别名]
    def test_get_error_found(self):
        """ Tests that an error model is returned given an exit_code other than 0"""

        error_interface_dict = {
            u"version": u"1.0",
            u"exit_codes": {u"1": self.error_1.name, u"2": self.error_2.name, u"3": self.error_3.name},
        }

        error_interface = ErrorInterface(error_interface_dict)
        error = error_interface.get_error(1)

        self.assertIsNotNone(error)
        self.assertEqual(error.name, Error.objects.get_unknown_error().name)
开发者ID:Carl4,项目名称:scale,代码行数:15,代码来源:test_error_interface.py

示例4: test_get_error_zero

# 需要导入模块: from job.configuration.interface.error_interface import ErrorInterface [as 别名]
# 或者: from job.configuration.interface.error_interface.ErrorInterface import get_error [as 别名]
    def test_get_error_zero(self):
        """ Tests that no error is returned when the exit_code is 0"""

        error_interface_dict = {
            'version': '1.0',
            'exit_codes': {
                '1': self.error_1.name,
                '2': self.error_2.name,
                '3': self.error_3.name,
            },
        }

        error_interface = ErrorInterface(error_interface_dict)
        error = error_interface.get_error(0)

        self.assertIsNone(error)
开发者ID:AppliedIS,项目名称:scale,代码行数:18,代码来源:test_error_interface.py

示例5: test_get_error_found

# 需要导入模块: from job.configuration.interface.error_interface import ErrorInterface [as 别名]
# 或者: from job.configuration.interface.error_interface.ErrorInterface import get_error [as 别名]
    def test_get_error_found(self):
        """ Tests that an error model is returned given an exit_code other than 0"""

        error_interface_dict = {
            'version': '1.0',
            'exit_codes': {
                '1': self.error_1.name,
                '2': self.error_2.name,
                '3': self.error_3.name,
            },
        }

        error_interface = ErrorInterface(error_interface_dict)
        error = error_interface.get_error(1)

        self.assertIsNotNone(error)
        self.assertEqual(error.name, self.error_1.name)
开发者ID:AppliedIS,项目名称:scale,代码行数:19,代码来源:test_error_interface.py

示例6: test_get_error_missing

# 需要导入模块: from job.configuration.interface.error_interface import ErrorInterface [as 别名]
# 或者: from job.configuration.interface.error_interface.ErrorInterface import get_error [as 别名]
    def test_get_error_missing(self):
        ''' Tests that an unknown error is returned when a non-registered name is found in the mapping'''

        error_interface_dict = {
            'version': '1.0',
            'exit_codes': {
                '1': self.error_1.name,
                '2': self.error_2.name,
                '3': self.error_3.name,
            },
        }

        error_interface = ErrorInterface(error_interface_dict)
        error = error_interface.get_error(4)

        self.assertIsNotNone(error)
        self.assertEqual(error.name, Error.objects.get_unknown_error().name)
开发者ID:cshamis,项目名称:scale,代码行数:19,代码来源:test_error_interface.py

示例7: test_get_error_missing

# 需要导入模块: from job.configuration.interface.error_interface import ErrorInterface [as 别名]
# 或者: from job.configuration.interface.error_interface.ErrorInterface import get_error [as 别名]
    def test_get_error_missing(self):
        """Tests that general algorithm error is returned when a non-registered name is found in the mapping"""

        # Clear error cache so test works correctly
        CACHED_BUILTIN_ERRORS.clear()

        error_interface_dict = {
            'version': '1.0',
            'exit_codes': {
                '1': self.error_1.name,
                '2': self.error_2.name,
                '3': self.error_3.name,
            },
        }

        error_interface = ErrorInterface(error_interface_dict)
        error = error_interface.get_error(4)

        self.assertIsNotNone(error)
        self.assertEqual(error.name, 'algorithm-unknown')
开发者ID:AppliedIS,项目名称:scale,代码行数:22,代码来源:test_error_interface.py

示例8: test_get_error_missing_default

# 需要导入模块: from job.configuration.interface.error_interface import ErrorInterface [as 别名]
# 或者: from job.configuration.interface.error_interface.ErrorInterface import get_error [as 别名]
    def test_get_error_missing_default(self):
        """Tests that custom error is returned when a non-registered name is found in the mapping"""

        # Clear error cache so test works correctly
        CACHED_BUILTIN_ERRORS.clear()

        error_interface_dict = {
            'version': '1.0',
            'exit_codes': {
                '1': self.error_1.name,
                '2': self.error_2.name,
                '3': self.error_3.name,
            },
        }

        default_error = error_test_utils.create_error()
        error_interface = ErrorInterface(error_interface_dict)
        error = error_interface.get_error(4, default_error.name)

        self.assertIsNotNone(error)
        self.assertEqual(error.name, default_error.name)
开发者ID:AppliedIS,项目名称:scale,代码行数:23,代码来源:test_error_interface.py


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