[clang] [libclang/python] Refactor enum usage (PR #95608)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 1 03:58:37 PDT 2024


================
@@ -10,26 +10,6 @@
 
 
 class TestTokenKind(unittest.TestCase):
-    def test_constructor(self):
----------------
DeinAlptraum wrote:

thNot really:
- `test_constructor`: this tests the ability to add enum variants "on the fly", which is not possible with the Python stdlib's `Enum` class
- `test_bad_register`: the `Enum` class tests for this on initialization, so if you define a duplicate `Enum` variant, you will get a failure on import already. This makes the test both a) effectively covered by that and b) you couldn't import the module to run such a test anyway in a case where there's a duplicate
- `test_unknown_value`: this is covered in `test_from_id` in `test_enums.py` since I added the `TokenKind` class to the test there 

https://github.com/llvm/llvm-project/pull/95608


More information about the cfe-commits mailing list