Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def test_connect_scoping_operator(server_type):
'supported starting server version 5.0')
def test_connect_label_space_operator(server_type):
op = dpf.core.Operator("Rescope", server=server_type)
dict = {"time": 1, "complex": 0}
op.connect(0, dict)
dic = {"time": 1, "complex": 0}
op.connect(0, dic)


def test_connect_datasources_operator(fields_container_csv, server_type):
Expand Down
11 changes: 5 additions & 6 deletions tests/test_stringfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def test_scopingdata_string_field(server_type):
pfield.scoping = scop
list_data = ["water", "oil", "gaz", "paint", "air"]
pfield.data = list_data
pfield.data
assert pfield.data == list_data
assert np.allclose(pfield.scoping.ids, list_ids)
pfield.data = np.asarray(list_data)
Expand All @@ -26,7 +25,7 @@ def test_scopingdata_string_field(server_type):
def test_set_get_data_string_field(server_type):
field = dpf.core.StringField(nentities=20, server=server_type)
data = []
for i in range(0, 20):
for _ in range(0, 20):
data.append("bla")
field.data = data
assert field.data == data
Expand Down Expand Up @@ -81,7 +80,7 @@ def test_stream_large_data_string_field(server_type):
nstring = 1000000
field = dpf.core.StringField(nentities=nstring, server=server_type)
data = []
for i in range(0, nstring):
for _ in range(0, nstring):
data.append("bla")
field.data = data
assert field.data == data
Expand All @@ -91,14 +90,14 @@ def test_stream_large_data_string_field(server_type):
def test_print_string_vector(server_type):
field = dpf.core.StringField(nentities=20, server=server_type)
data = []
for i in range(0, 20):
for _ in range(0, 20):
data.append("bla")
field.data = data
d = field.data
print(d)
assert "['bla', 'bla', 'bla'" in d.__str__()
data = []
for i in range(0, 2):
for _ in range(0, 2):
data.append("bla")
field.data = data
d = field.data
Expand All @@ -116,7 +115,7 @@ def test_print_string_field(server_type):
field = dpf.core.StringField(nentities=20, server=server_type)
assert "String Field" in str(field)
data = []
for i in range(0, 20):
for _ in range(0, 20):
data.append("bla")
field.data = data
field.scoping.ids = range(1, 21)
Expand Down
64 changes: 32 additions & 32 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ def test_connect_field_workflow(server_type):
wf.set_output_name("min", op, 0)
wf.set_output_name("max", op, 1)
wf.connect("field", inpt)
fOut = wf.get_output("min", dpf.core.types.field)
assert np.allclose(fOut.data, [1.0, 2.0, 3.0])
fOut = wf.get_output("max", dpf.core.types.field)
assert np.allclose(fOut.data, [7.0, 8.0, 9.0])
f_out = wf.get_output("min", dpf.core.types.field)
assert np.allclose(f_out.data, [1.0, 2.0, 3.0])
f_out = wf.get_output("max", dpf.core.types.field)
assert np.allclose(f_out.data, [7.0, 8.0, 9.0])

wf = dpf.core.Workflow(server=server_type)
wf.set_input_name("field", op.inputs.field)
wf.set_output_name("min", op.outputs.field_min)
wf.set_output_name("max", op.outputs.field_max)
wf.connect("field", inpt)
fOut = wf.get_output("min", dpf.core.types.field)
assert np.allclose(fOut.data, [1.0, 2.0, 3.0])
fOut = wf.get_output("max", dpf.core.types.field)
assert np.allclose(fOut.data, [7.0, 8.0, 9.0])
f_out = wf.get_output("min", dpf.core.types.field)
assert np.allclose(f_out.data, [1.0, 2.0, 3.0])
f_out = wf.get_output("max", dpf.core.types.field)
assert np.allclose(f_out.data, [7.0, 8.0, 9.0])


def test_connect_list_workflow(velocity_acceleration, server_type):
Expand All @@ -67,14 +67,14 @@ def test_connect_list_workflow(velocity_acceleration, server_type):
wf.set_input_name("time_scoping", op, 0)
wf.set_output_name("field", op, 0)
wf.connect("time_scoping", [1, 2])
fcOut = wf.get_output("field", dpf.core.types.fields_container)
assert fcOut.get_available_ids_for_label() == [1, 2]
f_out = wf.get_output("field", dpf.core.types.fields_container)
assert f_out.get_available_ids_for_label() == [1, 2]

wf.set_input_name("time_scoping", op.inputs.time_scoping)
wf.set_output_name("field", op.outputs.fields_container)
wf.connect("time_scoping", [1, 2])
fcOut = wf.get_output("field", dpf.core.types.fields_container)
assert fcOut.get_available_ids_for_label() == [1, 2]
f_out = wf.get_output("field", dpf.core.types.fields_container)
assert f_out.get_available_ids_for_label() == [1, 2]


def test_connect_fieldscontainer_workflow(server_type):
Expand All @@ -96,8 +96,8 @@ def test_connect_fieldscontainer_workflow(server_type):
wf.set_input_name("fields_container", op, 0)
wf.set_output_name("field", op, 0)
wf.connect("fields_container", fc)
fOut = wf.get_output("field", dpf.core.types.field)
assert fOut.data.size == 60
f_out = wf.get_output("field", dpf.core.types.field)
assert f_out.data.size == 60


def test_connect_fieldscontainer_2_workflow(server_type):
Expand All @@ -119,8 +119,8 @@ def test_connect_fieldscontainer_2_workflow(server_type):
wf.set_input_name("fields_container", op.inputs.fields_container)
wf.set_output_name("field", op.outputs.field_min)
wf.connect("fields_container", fc)
fOut = wf.get_output("field", dpf.core.types.field)
assert fOut.data.size == 60
f_out = wf.get_output("field", dpf.core.types.field)
assert f_out.data.size == 60


def test_connect_bool_workflow(server_type):
Expand Down Expand Up @@ -155,9 +155,9 @@ def test_connect_scoping_workflow(server_type):
wf.set_input_name("mesh_scoping", op, 1)
wf.connect("mesh_scoping", scop2)
wf.set_output_name("field", op, 0)
fOut = wf.get_output("field", dpf.core.types.field)
scopOut = fOut.scoping
assert np.allclose(scopOut.ids, list(range(1, 5)))
f_out = wf.get_output("field", dpf.core.types.field)
scop_out = f_out.scoping
assert np.allclose(scop_out.ids, list(range(1, 5)))


def test_connect_scoping_2_workflow(server_type):
Expand All @@ -179,9 +179,9 @@ def test_connect_scoping_2_workflow(server_type):
wf.set_input_name("mesh_scoping", op.inputs.mesh_scoping)
wf.connect("mesh_scoping", scop2)
wf.set_output_name("field", op, 0)
fOut = wf.get_output("field", dpf.core.types.field)
scopOut = fOut.scoping
assert np.allclose(scopOut.ids, list(range(1, 5)))
f_out = wf.get_output("field", dpf.core.types.field)
scop_out = f_out.scoping
assert np.allclose(scop_out.ids, list(range(1, 5)))


def test_connect_datasources_workflow(fields_container_csv, server_type):
Expand All @@ -195,17 +195,17 @@ def test_connect_datasources_workflow(fields_container_csv, server_type):
wf.connect("data_sources", data_sources)
wf.set_output_name("fields_container", op, 0)

fcOut = wf.get_output("fields_container", dpf.core.types.fields_container)
assert len(fcOut.get_available_ids_for_label()) == 4
f_out = wf.get_output("fields_container", dpf.core.types.fields_container)
assert len(f_out.get_available_ids_for_label()) == 4

wf = dpf.core.Workflow(server=server_type)
wf.add_operator(op)
wf.set_input_name("data_sources", op.inputs.data_sources)
wf.connect("data_sources", data_sources)
wf.set_output_name("fields_container", op, 0)

fcOut = wf.get_output("fields_container", dpf.core.types.fields_container)
assert len(fcOut.get_available_ids_for_label()) == 4
f_out = wf.get_output("fields_container", dpf.core.types.fields_container)
assert len(f_out.get_available_ids_for_label()) == 4


def test_connect_operator_workflow(server_type):
Expand All @@ -227,8 +227,8 @@ def test_connect_operator_workflow(server_type):
wf.set_output_name("field", op, 0)

wf.connect("comp", 0)
fOut = wf.get_output("field", dpf.core.types.field)
assert len(fOut.data) == 3
f_out = wf.get_output("field", dpf.core.types.field)
assert len(f_out.data) == 3


def test_connect_operator_2_workflow(server_type):
Expand All @@ -250,8 +250,8 @@ def test_connect_operator_2_workflow(server_type):
wf.set_output_name("field", op, 0)

wf.connect("comp", 0)
fOut = wf.get_output("field", dpf.core.types.field)
assert len(fOut.data) == 3
f_out = wf.get_output("field", dpf.core.types.field)
assert len(f_out.data) == 3


def test_output_mesh_workflow(cyclic_lin_rst, cyclic_ds, server_type):
Expand Down Expand Up @@ -343,8 +343,8 @@ def test_connect_label_space_workflow(server_type):
op = dpf.core.operators.utility.forward(server=server_type)
wf.add_operators([op])
wf.set_input_name("in", op, 0)
dict = {"time": 1, "complex": 0}
wf.connect("in", dict)
dic = {"time": 1, "complex": 0}
wf.connect("in", dic)


@conftest.raises_for_servers_version_under('5.0')
Expand Down