Skip to content

Commit e376d2f

Browse files
committed
Extend Python test
1 parent 9b4dd85 commit e376d2f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/python/unittest/API/APITest.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ def testOpenPMD_2_0(self):
419419

420420
E = meshes["E"]
421421
E.reset_dataset(io.Dataset(io.Datatype.DOUBLE, [10, 10, 10]))
422+
E.axis_labels = ["x", "y", "z"]
422423
E.grid_unit_SI = [1, 2, 3]
423424
E.grid_unit_dimension = [
424425
{io.Unit_Dimension.L: 1},
@@ -428,9 +429,9 @@ def testOpenPMD_2_0(self):
428429

429430
B = meshes["B"]
430431
B.reset_dataset(io.Dataset(io.Datatype.DOUBLE, [10, 10, 10]))
432+
B.axis_labels = ["x", "y", "z"]
431433
# This is deprecated for openPMD 2.0, a warning will be printed.
432434
B.grid_unit_SI = 3
433-
B.grid_unit_dimension = [{io.Unit_Dimension.L: 1} for _ in range(3)]
434435
B.make_constant(18)
435436

436437
write_2_0.close()
@@ -449,6 +450,7 @@ def testOpenPMD_2_0(self):
449450
B = meshes["B"]
450451
# Will return a list due to openPMD standard being set to 2.0.0
451452
self.assertEqual(B.grid_unit_SI, [3])
453+
# If the attribute is not defined, the mesh is implicitly spatial
452454
self.assertEqual(io.Unit_Dimension.as_maps(B.grid_unit_dimension), [
453455
{io.Unit_Dimension.L: 1} for _ in range(3)])
454456
read_2_0.close()
@@ -462,8 +464,9 @@ def testOpenPMD_2_0(self):
462464

463465
def unsupported_in_1_1():
464466
E.grid_unit_SI = [1, 2, 3]
465-
self.assertRaises(
466-
io.ErrorIllegalInOpenPMDStandard, unsupported_in_1_1)
467+
# self.assertRaises(
468+
# io.ErrorIllegalInOpenPMDStandard, unsupported_in_1_1)
469+
E.axis_labels = ["x", "y", "z"]
467470
E.grid_unit_dimension = [
468471
{io.Unit_Dimension.L: 1},
469472
{io.Unit_Dimension.L: 1},
@@ -472,9 +475,9 @@ def unsupported_in_1_1():
472475

473476
B = meshes["B"]
474477
B.reset_dataset(io.Dataset(io.Datatype.DOUBLE, [10, 10, 10]))
478+
B.axis_labels = ["x", "y", "z"]
475479
# This is deprecated for openPMD 2.0, a warning will be printed.
476480
B.grid_unit_SI = 3
477-
B.grid_unit_dimension = [{io.Unit_Dimension.L: 1} for _ in range(3)]
478481
B.make_constant(18)
479482

480483
write_1_1.close()
@@ -495,6 +498,7 @@ def unsupported_in_1_1():
495498
B = meshes["B"]
496499
# Will return a scalar due to openPMD standard being set to 2.0.0
497500
self.assertEqual(B.grid_unit_SI, 3)
501+
# If the attribute is not defined, the mesh is implicitly spatial
498502
self.assertEqual(io.Unit_Dimension.as_maps(B.grid_unit_dimension), [
499503
{io.Unit_Dimension.L: 1} for _ in range(3)])
500504
read_1_1.close()

0 commit comments

Comments
 (0)