test_utils.py 747 B

1234567891011121314151617181920
  1. # SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: Apache-2.0
  3. import unittest
  4. try:
  5. from typing import Any
  6. except ImportError:
  7. pass # only needed to check type annotations
  8. class Py23TestCase(unittest.TestCase):
  9. def __init__(self, *args, **kwargs): # type: (Any, Any) -> None
  10. super(Py23TestCase, self).__init__(*args, **kwargs)
  11. try:
  12. self.assertRaisesRegex
  13. except AttributeError:
  14. # assertRaisesRegexp is deprecated in Python3 but assertRaisesRegex doesn't exist in Python2
  15. # This fix is used in order to avoid using the alias from the six library
  16. self.assertRaisesRegex = self.assertRaisesRegexp # type: ignore