Skip to content

Commit dce77d9

Browse files
committed
adding tests to get patch coverage up
1 parent f758c9d commit dce77d9

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

pydra/compose/tests/test_python_fields.py

+28-8
Original file line numberDiff line numberDiff line change
@@ -430,30 +430,50 @@ def test_no_outputs1():
430430
"""Test function tasks with no outputs specified by None return type"""
431431

432432
@python.define
433-
def TestFunc(a: A) -> None:
434-
pass
433+
def TestFunc1(a: A) -> None:
434+
print(a)
435435

436-
outputs = TestFunc(a=A(x=7))()
436+
outputs = TestFunc1(a=A(x=7))()
437437
assert not task_fields(outputs)
438438

439439

440440
def test_no_outputs2():
441441
"""Test function tasks with no outputs set explicitly"""
442442

443443
@python.define(outputs=[])
444-
def TestFunc(a: A):
445-
pass
444+
def TestFunc2(a: A):
445+
print(a)
446446

447-
outputs = TestFunc(a=A(x=7))()
447+
outputs = TestFunc2(a=A(x=7))()
448448
assert not task_fields(outputs)
449449

450450

451451
def test_no_outputs_fail():
452452
"""Test function tasks with object inputs"""
453453

454454
@python.define(outputs=[])
455-
def TestFunc(a: A):
455+
def TestFunc3(a: A):
456456
return a
457457

458458
with pytest.raises(ValueError, match="No output fields were specified"):
459-
TestFunc(a=A(x=7))()
459+
TestFunc3(a=A(x=7))()
460+
461+
462+
def test_only_one_output_fail():
463+
464+
@python.define(outputs=["out1", "out2"])
465+
def TestFunc4(a: A):
466+
return a
467+
468+
with pytest.raises(ValueError, match="Multiple outputs specified"):
469+
TestFunc4(a=A(x=7))()
470+
471+
472+
def test_incorrect_num_outputs_fail():
473+
474+
@python.define(outputs=["out1", "out2"])
475+
def TestFunc5(a: A):
476+
return a, a, a
477+
478+
with pytest.raises(ValueError, match="Length of the outputs"):
479+
TestFunc5(a=A(x=7))()

0 commit comments

Comments
 (0)