@@ -253,7 +253,8 @@ def test_divergence(f):
253253 Function (),
254254 ids = ["scalar_scalar" , "scalar_vector" , "vector_scalar" , "vector_vector" ],
255255)
256- def test_laplacian (f ):
256+ @pytest .mark .parametrize ("method" , ["std" , "divgrad" ])
257+ def test_laplacian (f , method ):
257258
258259 # Unpack the function
259260 func_input , func , _ , _ , func_lap = f
@@ -265,7 +266,7 @@ def test_laplacian(f):
265266 output_ = LabelTensor (output_ , labels )
266267
267268 # Compute the true laplacian and the pina laplacian
268- pina_lap = laplacian (output_ = output_ , input_ = input_ )
269+ pina_lap = laplacian (output_ = output_ , input_ = input_ , method = method )
269270 true_lap = func_lap (input_ )
270271
271272 # Check the shape and labels of the laplacian
@@ -276,24 +277,34 @@ def test_laplacian(f):
276277 assert torch .allclose (pina_lap , true_lap )
277278
278279 # Test if labels are handled correctly
279- laplacian (output_ = output_ , input_ = input_ , components = output_ .labels [0 ])
280- laplacian (output_ = output_ , input_ = input_ , d = input_ .labels [0 ])
280+ laplacian (
281+ output_ = output_ ,
282+ input_ = input_ ,
283+ components = output_ .labels [0 ],
284+ method = method ,
285+ )
286+ laplacian (output_ = output_ , input_ = input_ , d = input_ .labels [0 ], method = method )
281287
282288 # Should fail if input not a LabelTensor
283289 with pytest .raises (TypeError ):
284- laplacian (output_ = output_ , input_ = input_ .tensor )
290+ laplacian (output_ = output_ , input_ = input_ .tensor , method = method )
285291
286292 # Should fail if output not a LabelTensor
287293 with pytest .raises (TypeError ):
288- laplacian (output_ = output_ .tensor , input_ = input_ )
294+ laplacian (output_ = output_ .tensor , input_ = input_ , method = method )
289295
290296 # Should fail for non-existent input labels
291297 with pytest .raises (RuntimeError ):
292- laplacian (output_ = output_ , input_ = input_ , d = ["x" , "y" ])
298+ laplacian (output_ = output_ , input_ = input_ , d = ["x" , "y" ], method = method )
293299
294300 # Should fail for non-existent output labels
295301 with pytest .raises (RuntimeError ):
296- laplacian (output_ = output_ , input_ = input_ , components = ["a" , "b" , "c" ])
302+ laplacian (
303+ output_ = output_ ,
304+ input_ = input_ ,
305+ components = ["a" , "b" , "c" ],
306+ method = method ,
307+ )
297308
298309
299310def test_advection_scalar ():
0 commit comments