RNA enum properties support
This commit is contained in:
@@ -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] = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user