Skip to content

Commit

Permalink
Tweak arithmetic/callable test
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Jan 26, 2024
1 parent c99a2ff commit fa38416
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/jobflow_remote/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""A series of toy workflows that can be used for testing."""
from typing import Callable
from typing import Callable, Optional

from jobflow import job

Expand All @@ -25,6 +25,11 @@ def write_file(n):

@job
def arithmetic(
a: float, b: float, op: Callable[[float, float], float] = lambda x, y: x + y
) -> float:
return op(a, b)
a,
b,
op: Optional[Callable] = None,
) -> Optional[float]:
if op:
return op(a, b)

return None
2 changes: 1 addition & 1 deletion tests/integration/test_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_job_with_callable_kwarg(worker, job_controller):
from jobflow_remote.testing import arithmetic

job_1 = arithmetic(1, -2, op=math.copysign)
job_2 = arithmetic(job_1.output, 1, op=math.dist)
job_2 = arithmetic([job_1.output], [1], op=math.dist)
job_3 = arithmetic(job_2.output, 2, op=math.pow)

flow = Flow([job_1, job_2, job_3])
Expand Down

0 comments on commit fa38416

Please sign in to comment.