Layers unittesting: update after doversion changes

Collections now are called "Collection 1", instead of "1"
This commit is contained in:
Dalai Felinto
2017-03-20 10:30:19 +01:00
parent 01c4e598e5
commit a6d4ac28f5
9 changed files with 29 additions and 0 deletions

View File

@@ -258,6 +258,7 @@ class RenderLayerTesting(unittest.TestCase):
# open file
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
# create sub-collections
three_b = bpy.data.objects.get('T.3b')
@@ -360,6 +361,25 @@ class RenderLayerTesting(unittest.TestCase):
while master_collection.collections:
master_collection.collections.remove(master_collection.collections[0])
def rename_collections(self, collection=None):
"""
Rename 'Collection 1' to '1'
"""
def strip_name(collection):
import re
if collection.name.startswith("Default Collection"):
collection.name = '1'
else:
collection.name = re.findall(r'\d+', collection.name)[0]
if collection is None:
import bpy
collection = bpy.context.scene.master_collection
for nested_collection in collection.collections:
strip_name(nested_collection)
self.rename_collections(nested_collection)
class MoveSceneCollectionTesting(RenderLayerTesting):
"""