PanelSpy - target not all callables

Because sometimes we have `Data` classes as panel attributes and they're also callable.
This commit is contained in:
Andrej730
2025-11-10 16:17:19 +05:00
parent 24f991ceb1
commit b10e5ad4d6
+3 -1
View File
@@ -18,6 +18,7 @@
from __future__ import annotations from __future__ import annotations
import os import os
import types
import bpy import bpy
import pytest import pytest
import traceback import traceback
@@ -81,7 +82,8 @@ class PanelSpy:
return self return self
sentinel = object() sentinel = object()
attr_value = getattr(self.blender_panel, attr, sentinel) attr_value = getattr(self.blender_panel, attr, sentinel)
if attr_value is not sentinel and not callable(attr_value): # Don't use `callable`, because we might have `Data` classes as panel attributes.
if attr_value is not sentinel and not isinstance(attr_value, types.FunctionType):
return attr_value return attr_value
return self return self