Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <b.mont29@gmail.com>2019-11-27 14:15:15 +0300
committerBastien Montagne <b.mont29@gmail.com>2019-11-27 14:19:10 +0300
commiteb798de101ac7946e2d719e763ad1f0fd3e26acd (patch)
tree1aa7f974879938404ead51fdb234bebe480e9e40 /tests/python
parent3fa2b85bfd672156f7019252d00f8859c1bd5b22 (diff)
Clean/Fix remaining cases of props assignments in resgistrable structs def.
We still had a few deprecated assignements of `bpy.props.xxx` to class members in our API documentation and one of our py tests. Annotations are to be used now. Also remove the section about `register_module` utils, this has been removed in 2.8. Fix T71877: Python API overview sample code warning: class MyMaterialProps contains a property which should be an annotation! Fix T71876: Python API overview references old bpy.utils.register_module function
Diffstat (limited to 'tests/python')
-rw-r--r--tests/python/bl_pyapi_idprop_datablock.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/python/bl_pyapi_idprop_datablock.py b/tests/python/bl_pyapi_idprop_datablock.py
index c020f920eb2..648b63d1637 100644
--- a/tests/python/bl_pyapi_idprop_datablock.py
+++ b/tests/python/bl_pyapi_idprop_datablock.py
@@ -54,8 +54,8 @@ def abort_if_false(expr, msg=None):
class TestClass(bpy.types.PropertyGroup):
- test_prop = bpy.props.PointerProperty(type=bpy.types.Object)
- name = bpy.props.StringProperty()
+ test_prop: bpy.props.PointerProperty(type=bpy.types.Object)
+ name: bpy.props.StringProperty()
def get_scene(lib_name, sce_name):
@@ -213,13 +213,14 @@ def test_restrictions1():
bl_idname = 'scene.test_op'
bl_label = 'Test'
bl_options = {"INTERNAL"}
- str_prop = bpy.props.StringProperty(name="str_prop")
+
+ str_prop: bpy.props.StringProperty(name="str_prop")
# disallow registration of datablock properties in operators
# will be checked in the draw method (test manually)
# also, see console:
# ValueError: bpy_struct "SCENE_OT_test_op" doesn't support datablock properties
- id_prop = bpy.props.PointerProperty(type=bpy.types.Object)
+ id_prop: bpy.props.PointerProperty(type=bpy.types.Object)
def execute(self, context):
return {'FINISHED'}
@@ -291,7 +292,7 @@ def test_regressions():
# test restrictions for datablock pointers
def test_restrictions2():
class TestClassCollection(bpy.types.PropertyGroup):
- prop = bpy.props.CollectionProperty(
+ prop: bpy.props.CollectionProperty(
name="prop_array",
type=TestClass)
bpy.utils.register_class(TestClassCollection)
@@ -299,9 +300,9 @@ def test_restrictions2():
class TestPrefs(bpy.types.AddonPreferences):
bl_idname = "testprefs"
# expecting crash during registering
- my_prop2 = bpy.props.PointerProperty(type=TestClass)
+ my_prop2: bpy.props.PointerProperty(type=TestClass)
- prop = bpy.props.PointerProperty(
+ prop: bpy.props.PointerProperty(
name="prop",
type=TestClassCollection,
description="test")
@@ -309,7 +310,7 @@ def test_restrictions2():
bpy.types.Addon.a = bpy.props.PointerProperty(type=bpy.types.Object)
class TestUIList(UIList):
- test = bpy.props.PointerProperty(type=bpy.types.Object)
+ test: bpy.props.PointerProperty(type=bpy.types.Object)
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
layout.prop(item, "name", text="", emboss=False, icon_value=icon)