Skip to content

Commit d68421e

Browse files
authored
ci(test): update default value of num fields in tests for BFE (#917)
1 parent 3be3c80 commit d68421e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ def license_context():
368368
yield
369369

370370

371+
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_11_0 = meets_version(
372+
get_server_version(core._global_server()), "11.0"
373+
)
374+
371375
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0 = meets_version(
372376
get_server_version(core._global_server()), "10.0"
373377
)

tests/test_resultobject.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from ansys.dpf.post.scalar import ComplexScalar, Scalar
3131
from ansys.dpf.post.tensor import ComplexTensor, Tensor
3232
from ansys.dpf.post.vector import ComplexVector, Vector
33+
from conftest import SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_11_0
3334

3435

3536
def test_scalar(allkindofcomplexity):
@@ -43,7 +44,10 @@ def test_scalar(allkindofcomplexity):
4344
)
4445
value = scalar.scalar
4546
assert isinstance(value, ResultData)
46-
assert value.num_fields == 2
47+
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_11_0:
48+
assert value.num_fields == 3
49+
else:
50+
assert value.num_fields == 2
4751
assert value[0].data[0] == 22.0
4852

4953

@@ -695,7 +699,10 @@ def test_temperature(allkindofcomplexity):
695699
# print(temp)
696700
assert temp._operator_name == "BFE"
697701
value = temp.scalar
698-
assert value.num_fields == 2
702+
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_11_0:
703+
assert value.num_fields == 3
704+
else:
705+
assert value.num_fields == 2
699706
assert value[0].data[0] == 22.0
700707
assert value[0].location == post.locations.nodal
701708
temp2 = solution.structural_temperature(

0 commit comments

Comments
 (0)