Update plots.py for PathLike to string handling error (#3261)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Joshua Einstein-Curtis 2025-01-16 09:38:19 -06:00 committed by GitHub
parent 32662b409a
commit bd874f1b3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -250,9 +250,10 @@ def voxel_to_vtk(voxel_file: PathLike, output: PathLike = 'plot.vti'):
writer.SetInputData(grid)
else:
writer.SetInput(grid)
output = str(output)
if not output.endswith(".vti"):
output += ".vti"
writer.SetFileName(str(output))
writer.SetFileName(output)
writer.Write()
return output

View file

@ -90,7 +90,7 @@ def test_voxel_plot(run_in_tmpdir):
assert Path('test_voxel_plot.vti').is_file()
vox_plot.filename = 'h5_voxel_plot'
vox_plot.to_vtk('another_test_voxel_plot.vti')
vox_plot.to_vtk(Path('another_test_voxel_plot.vti'))
assert Path('h5_voxel_plot.h5').is_file()
assert Path('another_test_voxel_plot.vti').is_file()