RNA enum properties support

This commit is contained in:
2026-09-21 11:18:10 +02:00
parent f575a84c13
commit f2efa629ba
8 changed files with 134 additions and 8 deletions
+35
View File
@@ -719,6 +719,41 @@ class TestCollectAllMethods(unittest.TestCase):
class TestGenerateTypesStub(unittest.TestCase):
def test_rna_enum_aliases_are_reusable(self) -> None:
structs = [
{
"name": "Panel",
"doc": "",
"base": "bpy_struct",
"properties": [
{
"name": "bl_space_type",
"type": 'Literal["EMPTY", "PROPERTIES"]',
"is_readonly": False,
"description": "",
},
{
"name": "bl_region_type",
"type": 'Literal["WINDOW", "HEADER"]',
"is_readonly": False,
"description": "",
},
],
"methods": [],
}
]
content = generate_types_stub(structs)
self.assertIn(
'SpaceType: TypeAlias = Literal["EMPTY", "PROPERTIES"]', content
)
self.assertIn(
'RegionType: TypeAlias = Literal["WINDOW", "HEADER"]', content
)
self.assertIn("bl_space_type: SpaceType", content)
self.assertIn("bl_region_type: RegionType", content)
def test_includes_header(self) -> None:
structs: list[StructData] = [
{