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
path: root/tests
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-10-02 03:15:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-02 04:59:16 +0300
commit41d2d6da0c96d351b47acb64d3e0decdba16cb16 (patch)
tree8f955ed71d907ab9f7ee97627a9a7c91192d139a /tests
parentbab9de2a52929fe2b45ecddb1eb09da3378e303b (diff)
Cleanup: pep8 (indentation, spacing, long lines)
Diffstat (limited to 'tests')
-rw-r--r--tests/python/alembic_export_tests.py5
-rw-r--r--tests/python/batch_import.py14
-rw-r--r--tests/python/bl_alembic_io_test.py8
-rw-r--r--tests/python/bl_animation_fcurves.py60
-rw-r--r--tests/python/bl_blendfile_io.py2
-rw-r--r--tests/python/bl_blendfile_liblink.py2
-rw-r--r--tests/python/bl_blendfile_utils.py2
-rw-r--r--tests/python/bl_constraints.py4
-rw-r--r--tests/python/bl_run_operators.py6
-rw-r--r--tests/python/eevee_render_tests.py4
-rwxr-xr-xtests/python/modules/global_report.py4
-rw-r--r--tests/python/modules/mesh_test.py18
-rwxr-xr-xtests/python/modules/render_report.py2
-rw-r--r--tests/python/operators.py2
-rw-r--r--tests/python/rna_array.py11
-rw-r--r--tests/python/rna_info_dump.py10
16 files changed, 94 insertions, 60 deletions
diff --git a/tests/python/alembic_export_tests.py b/tests/python/alembic_export_tests.py
index 1d34eb3fc81..9d1738691f0 100644
--- a/tests/python/alembic_export_tests.py
+++ b/tests/python/alembic_export_tests.py
@@ -592,7 +592,10 @@ class CustomPropertiesExportTest(AbstractAlembicTest):
def _run_export(self, tempdir: pathlib.Path) -> pathlib.Path:
abc = tempdir / 'custom-properties.abc'
- script = "import bpy; bpy.context.scene.frame_set(1); bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1)" % abc.as_posix()
+ script = (
+ "import bpy; bpy.context.scene.frame_set(1); "
+ "bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1)" % abc.as_posix()
+ )
self.run_blender('custom-properties.blend', script)
return abc
diff --git a/tests/python/batch_import.py b/tests/python/batch_import.py
index 20d96a69a79..7e64081cfbb 100644
--- a/tests/python/batch_import.py
+++ b/tests/python/batch_import.py
@@ -150,10 +150,20 @@ def main():
# Example background utility, add some text and renders or saves it (with options)
# Possible types are: string, int, long, choice, float and complex.
- parser.add_option("-o", "--operator", dest="operator", help="This text will be used to render an image", type="string")
+ parser.add_option(
+ "-o",
+ "--operator",
+ dest="operator",
+ help="This text will be used to render an image",
+ type="string")
parser.add_option("-p", "--path", dest="path", help="Path to use for searching for files", type='string')
parser.add_option("-m", "--match", dest="match", help="Wildcard to match filename", type="string")
- parser.add_option("-s", "--save_path", dest="save_path", help="Save the input file to a blend file in a new location", metavar='string')
+ parser.add_option(
+ "-s",
+ "--save_path",
+ dest="save_path",
+ help="Save the input file to a blend file in a new location",
+ metavar='string')
parser.add_option("-S", "--start", dest="start", help="From collected files, start with this index", metavar='int')
parser.add_option("-E", "--end", dest="end", help="From collected files, end with this index", metavar='int')
diff --git a/tests/python/bl_alembic_io_test.py b/tests/python/bl_alembic_io_test.py
index b9eca3057e7..53a0879f160 100644
--- a/tests/python/bl_alembic_io_test.py
+++ b/tests/python/bl_alembic_io_test.py
@@ -313,13 +313,13 @@ class CameraExportImportTest(unittest.TestCase):
self.loc_rot_scale('CAM_Unit_Transform', (0, 0, 0), (0, 0, 0))
self.loc_rot_scale('CAM_Look_+Y', (2, 0, 0), (90, 0, 0))
- self.loc_rot_scale('CAM_Static_Child_Left', (2-0.15, 0, 0), (90, 0, 0))
- self.loc_rot_scale('CAM_Static_Child_Right', (2+0.15, 0, 0), (90, 0, 0))
+ self.loc_rot_scale('CAM_Static_Child_Left', (2 - 0.15, 0, 0), (90, 0, 0))
+ self.loc_rot_scale('CAM_Static_Child_Right', (2 + 0.15, 0, 0), (90, 0, 0))
self.loc_rot_scale('Static_Child', (2, 0, 1), (90, 0, 0))
self.loc_rot_scale('CAM_Animated', (4, 0, 0), (90, 0, 0))
- self.loc_rot_scale('CAM_Animated_Child_Left', (4-0.15, 0, 0), (90, 0, 0))
- self.loc_rot_scale('CAM_Animated_Child_Right', (4+0.15, 0, 0), (90, 0, 0))
+ self.loc_rot_scale('CAM_Animated_Child_Left', (4 - 0.15, 0, 0), (90, 0, 0))
+ self.loc_rot_scale('CAM_Animated_Child_Right', (4 + 0.15, 0, 0), (90, 0, 0))
self.loc_rot_scale('Animated_Child', (4, 0, 1), (90, 0, 0))
bpy.context.scene.frame_set(10)
diff --git a/tests/python/bl_animation_fcurves.py b/tests/python/bl_animation_fcurves.py
index 432cfa5f3ab..b5772b8d335 100644
--- a/tests/python/bl_animation_fcurves.py
+++ b/tests/python/bl_animation_fcurves.py
@@ -39,38 +39,38 @@ class FCurveEvaluationTest(unittest.TestCase):
'Test dir %s should exist' % self.testdir)
def test_fcurve_versioning_291(self):
- # See D8752.
- bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "fcurve-versioning-291.blend"))
- cube = bpy.data.objects['Cube']
- fcurve = cube.animation_data.action.fcurves.find('location', index=0)
-
- self.assertAlmostEqual(0.0, fcurve.evaluate(1))
- self.assertAlmostEqual(0.019638698548078537, fcurve.evaluate(2))
- self.assertAlmostEqual(0.0878235399723053, fcurve.evaluate(3))
- self.assertAlmostEqual(0.21927043795585632, fcurve.evaluate(4))
- self.assertAlmostEqual(0.41515052318573, fcurve.evaluate(5))
- self.assertAlmostEqual(0.6332430243492126, fcurve.evaluate(6))
- self.assertAlmostEqual(0.8106040954589844, fcurve.evaluate(7))
- self.assertAlmostEqual(0.924369215965271, fcurve.evaluate(8))
- self.assertAlmostEqual(0.9830065965652466, fcurve.evaluate(9))
- self.assertAlmostEqual(1.0, fcurve.evaluate(10))
+ # See D8752.
+ bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "fcurve-versioning-291.blend"))
+ cube = bpy.data.objects['Cube']
+ fcurve = cube.animation_data.action.fcurves.find('location', index=0)
+
+ self.assertAlmostEqual(0.0, fcurve.evaluate(1))
+ self.assertAlmostEqual(0.019638698548078537, fcurve.evaluate(2))
+ self.assertAlmostEqual(0.0878235399723053, fcurve.evaluate(3))
+ self.assertAlmostEqual(0.21927043795585632, fcurve.evaluate(4))
+ self.assertAlmostEqual(0.41515052318573, fcurve.evaluate(5))
+ self.assertAlmostEqual(0.6332430243492126, fcurve.evaluate(6))
+ self.assertAlmostEqual(0.8106040954589844, fcurve.evaluate(7))
+ self.assertAlmostEqual(0.924369215965271, fcurve.evaluate(8))
+ self.assertAlmostEqual(0.9830065965652466, fcurve.evaluate(9))
+ self.assertAlmostEqual(1.0, fcurve.evaluate(10))
def test_fcurve_extreme_handles(self):
- # See D8752.
- bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "fcurve-extreme-handles.blend"))
- cube = bpy.data.objects['Cube']
- fcurve = cube.animation_data.action.fcurves.find('location', index=0)
-
- self.assertAlmostEqual(0.0, fcurve.evaluate(1))
- self.assertAlmostEqual(0.004713400732725859, fcurve.evaluate(2))
- self.assertAlmostEqual(0.022335870191454887, fcurve.evaluate(3))
- self.assertAlmostEqual(0.06331237405538559, fcurve.evaluate(4))
- self.assertAlmostEqual(0.16721539199352264, fcurve.evaluate(5))
- self.assertAlmostEqual(0.8327845335006714, fcurve.evaluate(6))
- self.assertAlmostEqual(0.9366875886917114, fcurve.evaluate(7))
- self.assertAlmostEqual(0.9776642322540283, fcurve.evaluate(8))
- self.assertAlmostEqual(0.9952865839004517, fcurve.evaluate(9))
- self.assertAlmostEqual(1.0, fcurve.evaluate(10))
+ # See D8752.
+ bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "fcurve-extreme-handles.blend"))
+ cube = bpy.data.objects['Cube']
+ fcurve = cube.animation_data.action.fcurves.find('location', index=0)
+
+ self.assertAlmostEqual(0.0, fcurve.evaluate(1))
+ self.assertAlmostEqual(0.004713400732725859, fcurve.evaluate(2))
+ self.assertAlmostEqual(0.022335870191454887, fcurve.evaluate(3))
+ self.assertAlmostEqual(0.06331237405538559, fcurve.evaluate(4))
+ self.assertAlmostEqual(0.16721539199352264, fcurve.evaluate(5))
+ self.assertAlmostEqual(0.8327845335006714, fcurve.evaluate(6))
+ self.assertAlmostEqual(0.9366875886917114, fcurve.evaluate(7))
+ self.assertAlmostEqual(0.9776642322540283, fcurve.evaluate(8))
+ self.assertAlmostEqual(0.9952865839004517, fcurve.evaluate(9))
+ self.assertAlmostEqual(1.0, fcurve.evaluate(10))
def main():
diff --git a/tests/python/bl_blendfile_io.py b/tests/python/bl_blendfile_io.py
index 35b089f9bb2..49814ea5902 100644
--- a/tests/python/bl_blendfile_io.py
+++ b/tests/python/bl_blendfile_io.py
@@ -46,7 +46,7 @@ class TestBlendFileSaveLoadBasic(TestHelper):
TESTS = (
TestBlendFileSaveLoadBasic,
- )
+)
def argparse_create():
diff --git a/tests/python/bl_blendfile_liblink.py b/tests/python/bl_blendfile_liblink.py
index 70614c3502d..b48deb7bd7b 100644
--- a/tests/python/bl_blendfile_liblink.py
+++ b/tests/python/bl_blendfile_liblink.py
@@ -44,7 +44,7 @@ class TestBlendLibLinkSaveLoadBasic(TestHelper):
TESTS = (
TestBlendLibLinkSaveLoadBasic,
- )
+)
def argparse_create():
diff --git a/tests/python/bl_blendfile_utils.py b/tests/python/bl_blendfile_utils.py
index 48e24cd0684..c87b47e5ce7 100644
--- a/tests/python/bl_blendfile_utils.py
+++ b/tests/python/bl_blendfile_utils.py
@@ -15,7 +15,7 @@ class TestHelper:
@classmethod
def blender_data_to_tuple(cls, bdata, pprint_name=None):
ret = sorted(tuple((cls.id_to_uid(k), sorted(tuple(cls.id_to_uid(vv) for vv in v)))
- for k, v in bdata.user_map().items()))
+ for k, v in bdata.user_map().items()))
if pprint_name is not None:
print("\n%s:" % pprint_name)
pprint.pprint(ret)
diff --git a/tests/python/bl_constraints.py b/tests/python/bl_constraints.py
index 09c76bca6bd..4deabc5f541 100644
--- a/tests/python/bl_constraints.py
+++ b/tests/python/bl_constraints.py
@@ -85,7 +85,7 @@ class AbstractConstraintTests(unittest.TestCase):
actual = self.bone_matrix(object_name, bone_name)
self.assert_matrix(actual, expect, object_name)
- def constraint_context(self, constraint_name: str, owner_name: str='') -> dict:
+ def constraint_context(self, constraint_name: str, owner_name: str = '') -> dict:
"""Return a context suitable for calling object constraint operators.
Assumes the owner is called "{constraint_name}.owner" if owner_name=''.
@@ -100,7 +100,7 @@ class AbstractConstraintTests(unittest.TestCase):
}
return context
- def bone_constraint_context(self, constraint_name: str, owner_name: str='', bone_name: str='') -> dict:
+ def bone_constraint_context(self, constraint_name: str, owner_name: str = '', bone_name: str = '') -> dict:
"""Return a context suitable for calling bone constraint operators.
Assumes the owner's object is called "{constraint_name}.owner" if owner_name=''.
diff --git a/tests/python/bl_run_operators.py b/tests/python/bl_run_operators.py
index b8b534a0a11..26fe6dac93d 100644
--- a/tests/python/bl_run_operators.py
+++ b/tests/python/bl_run_operators.py
@@ -503,7 +503,7 @@ def main():
if __name__ == "__main__":
- # ~ for i in range(200):
- # ~ RANDOM_SEED[0] += 1
- #~ main()
+ # for i in range(200):
+ # RANDOM_SEED[0] += 1
+ # main()
main()
diff --git a/tests/python/eevee_render_tests.py b/tests/python/eevee_render_tests.py
index 2f66af2344f..4c3ca28402f 100644
--- a/tests/python/eevee_render_tests.py
+++ b/tests/python/eevee_render_tests.py
@@ -43,13 +43,13 @@ def setup():
# Simple probe setup
bpy.ops.object.lightprobe_add(type='CUBEMAP', location=(0.5, 0, 1.5))
cubemap = bpy.context.selected_objects[0]
- cubemap.scale = (2.5,2.5,1.0)
+ cubemap.scale = (2.5, 2.5, 1.0)
cubemap.data.falloff = 0
cubemap.data.clip_start = 2.4
bpy.ops.object.lightprobe_add(type='GRID', location=(0, 0, 0.25))
grid = bpy.context.selected_objects[0]
- grid.scale = (1.735,1.735,1.735)
+ grid.scale = (1.735, 1.735, 1.735)
grid.data.grid_resolution_x = 3
grid.data.grid_resolution_y = 3
grid.data.grid_resolution_z = 2
diff --git a/tests/python/modules/global_report.py b/tests/python/modules/global_report.py
index 7e6172c345a..f7f181c4736 100755
--- a/tests/python/modules/global_report.py
+++ b/tests/python/modules/global_report.py
@@ -22,7 +22,7 @@ def _write_html(output_dir):
filepath = os.path.join(output_dir, filename)
combined_reports += pathlib.Path(filepath).read_text()
- combined_reports += "<br/>\n";
+ combined_reports += "<br/>\n"
html = """
<html>
@@ -67,7 +67,7 @@ def add(output_dir, category, name, filepath, failed=None):
name=name,
filepath=filepath)
- dirpath = os.path.join(output_dir, "report", category);
+ dirpath = os.path.join(output_dir, "report", category)
os.makedirs(dirpath, exist_ok=True)
filepath = os.path.join(dirpath, name + ".data")
pathlib.Path(filepath).write_text(html)
diff --git a/tests/python/modules/mesh_test.py b/tests/python/modules/mesh_test.py
index e1585aaa7a2..c85e7acf4e8 100644
--- a/tests/python/modules/mesh_test.py
+++ b/tests/python/modules/mesh_test.py
@@ -128,7 +128,14 @@ class MeshTest:
the public method run_test().
"""
- def __init__(self, test_object_name: str, expected_object_name: str, operations_stack=None, apply_modifiers=False, threshold=None):
+ def __init__(
+ self,
+ test_object_name: str,
+ expected_object_name: str,
+ operations_stack=None,
+ apply_modifiers=False,
+ threshold=None,
+ ):
"""
Constructs a MeshTest object. Raises a KeyError if objects with names expected_object_name
or test_object_name don't exist.
@@ -259,7 +266,6 @@ class MeshTest:
if self.apply_modifier:
bpy.ops.object.modifier_apply(modifier=modifier_spec.modifier_name)
-
def _bake_current_simulation(self, obj, test_mod_type, test_mod_name, frame_end):
for scene in bpy.data.scenes:
for modifier in obj.modifiers:
@@ -296,11 +302,15 @@ class MeshTest:
scene.frame_set(physics_spec.frame_end + 1)
- self._bake_current_simulation(test_object, physics_spec.modifier_type, physics_spec.modifier_name, physics_spec.frame_end)
+ self._bake_current_simulation(
+ test_object,
+ physics_spec.modifier_type,
+ physics_spec.modifier_name,
+ physics_spec.frame_end,
+ )
if self.apply_modifier:
bpy.ops.object.modifier_apply(modifier=physics_spec.modifier_name)
-
def _apply_operator(self, test_object, operator: OperatorSpec):
"""
Apply operator on test object.
diff --git a/tests/python/modules/render_report.py b/tests/python/modules/render_report.py
index 9e0c8ad6509..832d3849f01 100755
--- a/tests/python/modules/render_report.py
+++ b/tests/python/modules/render_report.py
@@ -31,7 +31,7 @@ COLORS = COLORS_DUMMY
# NOTE: Keep everything lowercase.
BLACKLIST = (
- # 'file_to_blacklist.blend',
+ # 'file_to_blacklist.blend',
)
diff --git a/tests/python/operators.py b/tests/python/operators.py
index 626aaedc724..901820c7b2d 100644
--- a/tests/python/operators.py
+++ b/tests/python/operators.py
@@ -146,7 +146,7 @@ def main():
"expectedCubeInsetDepth", "inset", {"thickness": 0.2, "depth": 0.2}],
["FACE", {35, 36, 37, 45, 46, 47, 55, 56, 57}, "testGridInsetRelativeOffset", "expectedGridInsetRelativeOffset",
"inset", {"thickness": 0.4, "use_relative_offset": True}],
- ]
+ ]
operators_test = OperatorTest(tests)
diff --git a/tests/python/rna_array.py b/tests/python/rna_array.py
index e0d63cf75ea..623766aa0a1 100644
--- a/tests/python/rna_array.py
+++ b/tests/python/rna_array.py
@@ -164,7 +164,8 @@ class TestMArray(unittest.TestCase):
def test_assign_item(self):
# arr[i] = x
- for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"), (rand_float, rand_int, rand_bool) * 2):
+ for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"),
+ (rand_float, rand_int, rand_bool) * 2):
rval = make_random_2d_array((4, 5), func)
for i in range(3):
@@ -172,7 +173,8 @@ class TestMArray(unittest.TestCase):
self.assertEqual(prop_to_list(getattr(test, arr)[i]), rval)
# arr[i][j] = x
- for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"), (rand_float, rand_int, rand_bool) * 2):
+ for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"),
+ (rand_float, rand_int, rand_bool) * 2):
arr = getattr(test, arr)
rval = make_random_array(5, func)
@@ -283,7 +285,10 @@ def prop_to_list(prop):
def suite():
- return unittest.TestSuite([unittest.TestLoader().loadTestsFromTestCase(TestArray), unittest.TestLoader().loadTestsFromTestCase(TestMArray)])
+ return unittest.TestSuite([
+ unittest.TestLoader().loadTestsFromTestCase(TestArray),
+ unittest.TestLoader().loadTestsFromTestCase(TestMArray),
+ ])
if __name__ == "__main__":
diff --git a/tests/python/rna_info_dump.py b/tests/python/rna_info_dump.py
index 01cbe8d290b..bca912f39cf 100644
--- a/tests/python/rna_info_dump.py
+++ b/tests/python/rna_info_dump.py
@@ -81,7 +81,10 @@ def api_dump(use_properties=True, use_functions=True):
for prop in v.properties:
if prop.collection_type:
- funcs = [(prop.identifier + "." + func.identifier, func) for func in prop.collection_type.functions]
+ funcs = [
+ (prop.identifier + "." + func.identifier, func)
+ for func in prop.collection_type.functions
+ ]
for func_id, func in funcs:
data.append(func_to_str(struct_id_str, func_id, func))
data.sort()
@@ -100,7 +103,10 @@ def api_dump(use_properties=True, use_functions=True):
for prop in v.properties:
if prop.collection_type:
- props = [(prop.identifier + "." + prop_sub.identifier, prop_sub) for prop_sub in prop.collection_type.properties]
+ props = [
+ (prop.identifier + "." + prop_sub.identifier, prop_sub)
+ for prop_sub in prop.collection_type.properties
+ ]
for prop_sub_id, prop_sub in props:
data.append(prop_to_str(struct_id_str, prop_sub_id, prop_sub))
data.sort()