From 05ae0e15d9acbfba1a6960011dffe772539c7745 Mon Sep 17 00:00:00 2001 From: Brady Johnston Date: Sat, 6 Apr 2024 08:19:06 +0800 Subject: [PATCH] fix starfile tests --- tests/test_star.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_star.py b/tests/test_star.py index 36f907cf..2a68598d 100644 --- a/tests/test_star.py +++ b/tests/test_star.py @@ -33,7 +33,7 @@ def test_starfile_attributes(type): # Activate the rotation debug mode in the nodetreee and get the quaternion attribute debugnode = mn.blender.nodes.star_node( ensemble.node_group).node_tree.nodes['Switch.001'] - debugnode.inputs[1].default_value = True + debugnode.inputs['Switch'].default_value = True quat_attribute = ensemble.get_attribute('MNDEBUGEuler', evaluate=True) # Convert from blender to scipy conventions and then into Scipy rotation @@ -42,6 +42,7 @@ def test_starfile_attributes(type): # To compare the two rotation with multiply one with the inverse of the other assert (rot_from_euler * rot_from_geo_nodes.inv()).magnitude().max() < 1e-5 + def test_categorical_attributes(): file = data_dir / "cistem.star" ensemble = mn.io.star.load(file) @@ -50,7 +51,7 @@ def test_categorical_attributes(): def test_micrograph_conversion(): from pathlib import Path - + file = data_dir / "cistem.star" ensemble = mn.io.star.load(file) tiff_path = data_dir / "montage.tiff" @@ -58,6 +59,7 @@ def test_micrograph_conversion(): ensemble._convert_mrc_to_tiff() assert tiff_path.exists() + def test_micrograph_loading(): import bpy file = data_dir / "cistem.star" @@ -69,11 +71,13 @@ def test_micrograph_loading(): ensemble.star_node.inputs['Show Micrograph'].default_value = True bpy.context.evaluated_depsgraph_get().update() assert tiff_path.exists() - # Ensure montage get only loaded once - assert sum(1 for image in bpy.data.images.keys() if 'montage' in image) == 1 + # Ensure montage get only loaded once + assert sum(1 for image in bpy.data.images.keys() + if 'montage' in image) == 1 assert ensemble.micrograph_material.node_tree.nodes['Image Texture'].image.name == 'montage.tiff' assert ensemble.star_node.inputs['Micrograph'].default_value.name == 'montage.tiff' + def test_rehydration(tmp_path): import bpy bpy.ops.wm.read_homefile()