當前位置: 首頁>>代碼示例>>Python>>正文


Python error_interface.ErrorInterface類代碼示例

本文整理匯總了Python中job.configuration.interface.error_interface.ErrorInterface的典型用法代碼示例。如果您正苦於以下問題:Python ErrorInterface類的具體用法?Python ErrorInterface怎麽用?Python ErrorInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ErrorInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_error_names_none

    def test_get_error_names_none(self):
        """Tests getting error names when there is no error interface."""

        error_interface_dict = {}

        error_interface = ErrorInterface(error_interface_dict)

        error_names = error_interface.get_error_names()
        self.assertSetEqual(error_names, set())
開發者ID:AppliedIS,項目名稱:scale,代碼行數:9,代碼來源:test_error_interface.py

示例2: test_get_error_names_empty

    def test_get_error_names_empty(self):
        """Tests getting error names when there are no exit codes defined."""

        error_interface_dict = {u"version": u"1.0", u"exit_codes": {}}

        error_interface = ErrorInterface(error_interface_dict)

        error_names = error_interface.get_error_names()
        self.assertSetEqual(error_names, set())
開發者ID:Carl4,項目名稱:scale,代碼行數:9,代碼來源:test_error_interface.py

示例3: test_get_error_names

    def test_get_error_names(self):
        """Tests getting error names from 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}}

        error_interface = ErrorInterface(error_interface_dict)

        error_names = error_interface.get_error_names()
        self.assertSetEqual(error_names, {self.error_1.name, self.error_2.name})
開發者ID:Carl4,項目名稱:scale,代碼行數:9,代碼來源:test_error_interface.py

示例4: test_get_error_names_empty

    def test_get_error_names_empty(self):
        """Tests getting error names when there are no exit codes defined."""

        error_interface_dict = {
            'version': '1.0',
            'exit_codes': {},
        }

        error_interface = ErrorInterface(error_interface_dict)

        error_names = error_interface.get_error_names()
        self.assertSetEqual(error_names, set())
開發者ID:AppliedIS,項目名稱:scale,代碼行數:12,代碼來源:test_error_interface.py

示例5: test_get_error_names_unique

    def test_get_error_names_unique(self):
        """Tests getting error names without duplicates."""

        error_interface_dict = {
            u"version": u"1.0",
            u"exit_codes": {u"0": self.error_1.name, u"2": self.error_2.name, u"5": self.error_1.name},
        }

        error_interface = ErrorInterface(error_interface_dict)

        error_names = error_interface.get_error_names()
        self.assertSetEqual(error_names, {self.error_1.name, self.error_2.name})
開發者ID:Carl4,項目名稱:scale,代碼行數:12,代碼來源:test_error_interface.py

示例6: test_get_error_zero

    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,代碼行數:12,代碼來源:test_error_interface.py

示例7: test_get_error_found

    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,代碼行數:13,代碼來源:test_error_interface.py

示例8: test_validate_empty

    def test_validate_empty(self):
        """Tests validating no error names."""

        error_interface_dict = {
            'version': '1.0',
            'exit_codes': {
            },
        }

        error_interface = ErrorInterface(error_interface_dict)

        # No exception is passing
        error_interface.validate()
開發者ID:AppliedIS,項目名稱:scale,代碼行數:13,代碼來源:test_error_interface.py

示例9: test_get_error_missing

    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,代碼行數:13,代碼來源:test_error_interface.py

示例10: test_get_error_names

    def test_get_error_names(self):
        """Tests getting error names from the mapping."""

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

        error_interface = ErrorInterface(error_interface_dict)

        error_names = error_interface.get_error_names()
        self.assertSetEqual(error_names, {self.error_1.name, self.error_2.name})
開發者ID:AppliedIS,項目名稱:scale,代碼行數:15,代碼來源:test_error_interface.py

示例11: test_validate_success

    def test_validate_success(self):
        """Tests validating all error names."""

        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)

        # No exception is passing
        error_interface.validate()
開發者ID:AppliedIS,項目名稱:scale,代碼行數:16,代碼來源:test_error_interface.py

示例12: test_get_error_zero

    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,代碼行數:16,代碼來源:test_error_interface.py

示例13: test_get_error_names_unique

    def test_get_error_names_unique(self):
        """Tests getting error names without duplicates."""

        error_interface_dict = {
            'version': '1.0',
            'exit_codes': {
                '0': self.error_1.name,
                '2': self.error_2.name,
                '5': self.error_1.name,
            },
        }

        error_interface = ErrorInterface(error_interface_dict)

        error_names = error_interface.get_error_names()
        self.assertSetEqual(error_names, {self.error_1.name, self.error_2.name})
開發者ID:AppliedIS,項目名稱:scale,代碼行數:16,代碼來源:test_error_interface.py

示例14: test_get_error_found

    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,代碼行數:17,代碼來源:test_error_interface.py

示例15: test_get_error_missing

    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,代碼行數:17,代碼來源:test_error_interface.py


注:本文中的job.configuration.interface.error_interface.ErrorInterface類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。