refactor: refactor vtk filter without try/except scheme#185
Merged
paloma-martinez merged 54 commits intomainfrom Dec 5, 2025
Merged
Conversation
…ilterAndPlugins Update to the last version of the main
…ilterAndPlugins Update to the last version of the main
…ilterAndPlugins Update to the last version of the main
paloma-martinez
requested changes
Nov 27, 2025
...-processing/src/geos/processing/generic_processing_tools/CreateConstantAttributePerRegion.py
Outdated
Show resolved
Hide resolved
...-processing/src/geos/processing/generic_processing_tools/CreateConstantAttributePerRegion.py
Outdated
Show resolved
Hide resolved
...-processing/src/geos/processing/generic_processing_tools/CreateConstantAttributePerRegion.py
Outdated
Show resolved
Hide resolved
...-processing/src/geos/processing/generic_processing_tools/CreateConstantAttributePerRegion.py
Outdated
Show resolved
Hide resolved
...-processing/src/geos/processing/generic_processing_tools/CreateConstantAttributePerRegion.py
Outdated
Show resolved
Hide resolved
Comment on lines
744
to
750
| if not createAttribute( self.output, | ||
| array, | ||
| attributeName, | ||
| componentNames=componentNames, | ||
| onPoints=onPoints, | ||
| logger=self.logger ): | ||
| raise ValueError( f"Something got wrong during the creation of the attribute { attributeName }." ) |
Collaborator
There was a problem hiding this comment.
same comment about raise and createAttribute
Comment on lines
166
to
172
| if not createConstantAttribute( volumeMesh, [ blockIndex ], | ||
| PostProcessingOutputsEnum.BLOCK_INDEX.attributeName, | ||
| onPoints=False, | ||
| logger=self.logger ): | ||
| raise ValueError( | ||
| f"Something got wrong during the creation of the attribute { PostProcessingOutputsEnum.BLOCK_INDEX.attributeName }." | ||
| ) |
Comment on lines
378
to
+391
| if not createAttribute( | ||
| self.outputMesh, scuAttribute, SCUAttributeName, (), self.attributeOnPoints, logger=self.logger ): | ||
| self.logger.error( f"Failed to create attribute {SCUAttributeName}." ) | ||
| raise | ||
| raise ValueError( f"Failed to create attribute {SCUAttributeName}." ) |
Comment on lines
36
to
61
| @pytest.mark.parametrize( "meshFromName, meshToName, attributeNames, onPoints, error", [ | ||
| ( "dataset", "emptydataset", {}, False, "ValueError" ), | ||
| ( "dataset", "emptydataset", { "Fault" }, False, "AttributeError" ), | ||
| ( "dataset", "dataset", { "GLOBAL_IDS_CELLS" }, False, "AttributeError" ), | ||
| ( "multiblock", "emptymultiblock", { "FAULT" }, False, "AttributeError" ), | ||
| ( "dataset", "emptyFracture", { "FAULT" }, False, "ValueError" ), | ||
| ] ) | ||
| def test_AttributeMappingRaises( | ||
| dataSetTest: Any, | ||
| meshFromName: str, | ||
| meshToName: str, | ||
| attributeNames: set[ str ], | ||
| onPoints: bool, | ||
| error: str, | ||
| ) -> None: | ||
| """Test the fails of the filter.""" | ||
| meshFrom: Union[ vtkDataSet, vtkMultiBlockDataSet ] = dataSetTest( meshFromName ) | ||
| meshTo: Union[ vtkDataSet, vtkMultiBlockDataSet ] = dataSetTest( meshToName ) | ||
| attributeMappingFilter: AttributeMapping = AttributeMapping( meshFrom, meshTo, attributeNames, onPoints ) | ||
|
|
||
| if error == "AttributeError": | ||
| with pytest.raises( AttributeError ): | ||
| attributeMappingFilter.applyFilter() | ||
| elif error == "ValueError": | ||
| with pytest.raises( ValueError ): | ||
| attributeMappingFilter.applyFilter() |
Collaborator
There was a problem hiding this comment.
Could you split the test at least in two (e.g. AttributeError/ ValueError) and comment briefly what is tested (raise due to xxxx ).
Comment on lines
125
to
131
| createConstantAttributePerRegionFilter.applyFilter() | ||
| elif error == "AttributeError": | ||
| with pytest.raises( AttributeError ): | ||
| createConstantAttributePerRegionFilter.applyFilter() | ||
| elif error == "ValueError": | ||
| with pytest.raises( ValueError ): | ||
| createConstantAttributePerRegionFilter.applyFilter() |
Collaborator
There was a problem hiding this comment.
Can you also split this test please (not fail/fail type 1/ fail type 2)
Base automatically changed from
RomainBaville/refactor/AddAndCheckLoggerForFilterAndPlugins
to
main
December 1, 2025 10:03
paloma-martinez
approved these changes
Dec 4, 2025
geos-processing/src/geos/processing/post_processing/SurfaceGeomechanics.py
Outdated
Show resolved
Hide resolved
…TryExceptScheme Update to the last version of the main
…TryExceptScheme Update to the last version of the main.
paloma-martinez
approved these changes
Dec 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pr aims to update the filter to not use try/except scheme. This scheme must be used in the upper function (main or ParaView plugin). The function applyFilter of the filter must raise exception if needed.
The tests and the ParaView plugin are updated to.
This pr follows the pr #178