@@ -336,6 +336,32 @@ def test_openvdb_field_empty_initialization(self, tmpdir):
336336
337337 assert tmpdir .join ("empty_init.vdb" ).exists ()
338338
339+ def test_vdb_origin_none_raises (self ):
340+ data = np .ones ((5 , 5 , 5 ))
341+
342+ with pytest .raises (ValueError , match = "origin must be provided" ):
343+ gridData .OpenVDB .OpenVDBField (grid = data , origin = None , delta = (1 , 1 , 1 ))
344+
345+ def test_vdb_origin_wrong_length_raises (self ):
346+ data = np .ones ((5 , 5 , 5 ))
347+
348+ with pytest .raises (ValueError , match = "length-3" ):
349+ gridData .OpenVDB .OpenVDBField (grid = data , origin = (0 , 0 ), delta = (1 , 1 , 1 ))
350+
351+ def test_vdb_write_without_grid_raises (self , tmpdir ):
352+ vdb_field = gridData .OpenVDB .OpenVDBField ()
353+
354+ outfile = str (tmpdir / "test.vdb" )
355+
356+ with pytest .raises (ValueError , match = "No grid data" ):
357+ vdb_field .write (str (outfile ))
358+
359+ def test_grid_convert_to_vdb (self , grid345 ):
360+ data , g = grid345
361+ native = g .convert_to ("vdb" )
362+
363+ assert isinstance (native , vdb .GridBase )
364+
339365
340366@pytest .mark .skipif (
341367 not HAS_OPENVDB , reason = "Need openvdb to test import error handling"
0 commit comments