예제 #1
0
    def test_get_error_code_empty_code_field(self):
        error_field = "::"

        result = get_error_code(error_field)

        self.assertIsNone(result)
예제 #2
0
    def test_get_error_code_short_invalid_field(self):
        error_field = "12::"

        result = get_error_code(error_field)

        self.assertIsNone(result)
예제 #3
0
    def test_get_error_code(self):
        error_field = "123::"

        result = get_error_code(error_field)

        self.assertEqual(result, 123)
예제 #4
0
    def test_get_error_code_none_field(self):
        error_field = None

        result = get_error_code(error_field)

        self.assertIsNone(result)
예제 #5
0
 def error_code(self) -> Optional[int]:
     """Error code part of the error code part of the `error\
     <https://docs.cometd.org/current/reference/#_code_error_code>`_, \
     message field"""
     return utils.get_error_code(self.error)