-
Notifications
You must be signed in to change notification settings - Fork 0
Address review comments: fix docstrings and restore test mismatch behavior #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
a38f08b
c9e2a31
fdd8b4f
da6b1ee
5328021
a106387
5ab7b4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,39 +2,43 @@ | |||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| # 3-argument function to trigger py_callback<3> | ||||||||||||||||||
| def sum_three(a: int, b: int, c: int) -> int: | ||||||||||||||||||
| def sum_three(i: int, j: int, k: int) -> int: | ||||||||||||||||||
| """Sum three integers.""" | ||||||||||||||||||
| return a + b + c | ||||||||||||||||||
| return i + j + k | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| # Function that raises exception to test error handling | ||||||||||||||||||
| def raise_error(a: int) -> int: | ||||||||||||||||||
| def raise_error(i: int) -> int: | ||||||||||||||||||
| """Raise a RuntimeError.""" | ||||||||||||||||||
| raise RuntimeError("Intentional failure") | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| # Invalid bool return (2) | ||||||||||||||||||
| def bad_bool(a: int) -> bool: | ||||||||||||||||||
| def bad_bool(i: int) -> bool: | ||||||||||||||||||
| """Return an invalid boolean value.""" | ||||||||||||||||||
| return 2 # type: ignore | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| # Invalid long return (float) | ||||||||||||||||||
| def bad_long(a: int) -> "long": # type: ignore # noqa: F821 | ||||||||||||||||||
| def bad_long(i: int) -> "long": # type: ignore # noqa: F821 | ||||||||||||||||||
| """Return a float instead of an int.""" | ||||||||||||||||||
| return 1.5 # type: ignore | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| # Invalid uint return (negative) | ||||||||||||||||||
| def bad_uint(a: int) -> "unsigned int": # type: ignore # noqa: F722 | ||||||||||||||||||
| def bad_uint(i: int) -> "unsigned int": # type: ignore # noqa: F722 | ||||||||||||||||||
| """Return a negative value for unsigned int.""" | ||||||||||||||||||
| return -5 # type: ignore | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| # Function with mismatching annotation count vs config inputs | ||||||||||||||||||
| def two_args(a: int, b: int) -> int: | ||||||||||||||||||
| """Sum two integers.""" | ||||||||||||||||||
| return a + b | ||||||||||||||||||
| def two_args(i: int, j: int, k: int) -> int: # noqa: ARG001 | ||||||||||||||||||
| """Sum only the first two of three integers (tests parameter count mismatch). | ||||||||||||||||||
|
|
||||||||||||||||||
| Note: Parameter k is intentionally unused - this tests that the function | ||||||||||||||||||
| accepts 3 parameters to match input_family but doesn't use all of them. | ||||||||||||||||||
| """ | ||||||||||||||||||
|
||||||||||||||||||
| def two_args(i: int, j: int, k: int) -> int: # noqa: ARG001 | |
| """Sum only the first two of three integers (tests parameter count mismatch). | |
| Note: Parameter k is intentionally unused - this tests that the function | |
| accepts 3 parameters to match input_family but doesn't use all of them. | |
| """ | |
| def two_args(i: int, j: int) -> int: | |
| """Sum two integers while config provides three inputs (tests parameter count mismatch).""" |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,82 +14,82 @@ class double(float): # noqa: N801 | |||||||||||||||||||||
| pass | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def add_float(i: float, j: float) -> float: | ||||||||||||||||||||||
| def add_float(f1: float, f2: float) -> float: | ||||||||||||||||||||||
| """Add two floats. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Args: | ||||||||||||||||||||||
| i (float): First input. | ||||||||||||||||||||||
| j (float): Second input. | ||||||||||||||||||||||
| f1 (float): First input. | ||||||||||||||||||||||
| f2 (float): Second input. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||
| float: Sum of the two inputs. | ||||||||||||||||||||||
| """ | ||||||||||||||||||||||
| return i + j | ||||||||||||||||||||||
| return f1 + f2 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def add_double(i: double, j: double) -> double: | ||||||||||||||||||||||
| def add_double(d1: double, d2: double) -> double: | ||||||||||||||||||||||
| """Add two doubles. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Args: | ||||||||||||||||||||||
| i (float): First input. | ||||||||||||||||||||||
| j (float): Second input. | ||||||||||||||||||||||
| d1 (float): First input. | ||||||||||||||||||||||
| d2 (float): Second input. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||
| float: Sum of the two inputs. | ||||||||||||||||||||||
|
||||||||||||||||||||||
| d1 (float): First input. | |
| d2 (float): Second input. | |
| Returns: | |
| float: Sum of the two inputs. | |
| d1 (double): First input. | |
| d2 (double): Second input. | |
| Returns: | |
| double: Sum of the two inputs. |
Outdated
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The add_unsigned docstring says the return type is int, but the function is annotated to return "unsigned int". Update the docstring return type/description so it matches the annotation.
| u1 (int): First input. | |
| u2 (int): Second input. | |
| Returns: | |
| int: Sum of the two inputs. | |
| u1 ("unsigned int"): First input. | |
| u2 ("unsigned int"): Second input. | |
| Returns: | |
| "unsigned int": Sum of the two inputs. |
Outdated
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The collect_double docstring lists argument types as float, but the function takes double objects. Update the docstring types to match the signature.
| d1 (float): First input. | |
| d2 (float): Second input. | |
| d1 (double): First input. | |
| d2 (double): Second input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is trailing whitespace on the blank line inside this docstring (violates the repo formatting rules and can fail whitespace checks). Remove the spaces so the line is empty.