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
2 changes: 1 addition & 1 deletion .github/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"devDependencies": {
"pyright": "1.1.371"
"pyright": "1.1.373"
}
}
12 changes: 9 additions & 3 deletions tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,21 @@ def myexp(a: float, b: float) -> float:
return a**b

# input parsing
# since the Command class is not generic
# in the input type this does not understand
# that this command should only be called with
# float/int. We ignore this below
cmd: Command[float, float] = Command(
1, abs, input_parser=lambda x: x + 1
) # pyright: ignore
1,
abs, # pyright: ignore
input_parser=lambda x: x + 1,
)
assert cmd(-10) == 9

# input *and* output parsing
cmd = Command(
1,
abs,
abs, # pyright: ignore
input_parser=lambda x: x + 2,
output_parser=lambda y: 3 * y, # pyright: ignore
)
Expand Down