def test_surface_model_loader_2_surface_no_assembly(): config = ConfigurationManager('tests/data/config/surface_model_two.json') config_data = config.get_copy() loader = SurfaceModelLoader(config_data) assert loader is not None assert len(loader.get_assembly_names()) == 0 assert len(loader.get_surface_model_names()) == 2
def test_surface_model_loader_2_surface_no_prefix(): config_with_no_prefix_in_json = ConfigurationManager('tests/data/config/surface_model_two_no_prefix.json') config_with_no_prefix_in_json_data = config_with_no_prefix_in_json.get_copy() loader_no_prefix = SurfaceModelLoader(config_with_no_prefix_in_json_data, directory_prefix="tests/data/models/Liver/") assert loader_no_prefix is not None assert len(loader_no_prefix.get_assembly_names()) == 0 assert len(loader_no_prefix.get_surface_model_names()) == 2
def test_surface_model_loader_2_in_assembly_on_its_own(setup_vtk_overlay_window): config = ConfigurationManager('tests/data/config/surface_model_two_assemblies.json') config_data = config.get_copy() loader = SurfaceModelLoader(config_data) assert loader is not None assert len(loader.get_assembly_names()) == 2 assert len(loader.get_surface_model_names()) == 3 widget, _, _, app = setup_vtk_overlay_window widget.add_vtk_models(loader.get_surface_models()) widget.show()
def test_surface_model_loader_2_surface_with_assembly(): config = ConfigurationManager('tests/data/config/surface_model_two_in_assembly.json') config_data = config.get_copy() loader = SurfaceModelLoader(config_data) assert loader is not None assert len(loader.get_assembly_names()) == 1 assert len(loader.get_surface_model_names()) == 2 # Call these functions for coverage purposes loader.get_assembly("veins") model = loader.get_surface_model("portal veins") # Check, the name should come from json file. assert model.get_name() == "portal veins"
def test_surface_model_loader_with_no_shading(): config_with_no_shading = ConfigurationManager('tests/data/config/surface_model_no_shading.json') config = config_with_no_shading.get_copy() loader = SurfaceModelLoader(config) assert len(loader.get_surface_models()) == 1 assert loader.get_surface_model('liver').get_no_shading()
def test_duplicate_surface_in_assembly_raises_error(): config = ConfigurationManager('tests/data/config/surface_model_duplicates_in_assembly.json') config_data = config.get_copy() with pytest.raises(ValueError): SurfaceModelLoader(config_data)
def test_assembly_surface_doesnt_exist_raises_error(): config = ConfigurationManager('tests/data/config/invalid_surface_in_assembly.json') config_data = config.get_copy() with pytest.raises(KeyError): SurfaceModelLoader(config_data)
def test_no_surfaces_raises_error(): config = ConfigurationManager('tests/data/config/invalid_config.json') config_data = config.get_copy() with pytest.raises(KeyError): SurfaceModelLoader(config_data)