test_python_receiver.py¶
tests/test_python_receiver.py
A Python method's receiver is its first parameter, whatever it is named (R5-CORE D1; 2.0.0).
test_a_staticmethod_has_no_receiver
None test_python_receiver.test_a_staticmethod_has_no_receiver()
A staticmethod's first parameter is an ordinary argument.
tests/test_python_receiver.py:37
Checks
assert _scopes(src)["helper"] == ("", "item")
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured |
Source · 4 lines
def test_a_staticmethod_has_no_receiver() -> None:
"""@brief A staticmethod's first parameter is an ordinary argument."""
src = "class Foo:\n @staticmethod\n def run(item):\n item.helper()\n"
assert _scopes(src)["helper"] == ("", "item")1 more lines, not shown
Activity · 2 steps
test_the_first_parameter_is_the_receiver
None test_python_receiver.test_the_first_parameter_is_the_receiver(str receiver)
`<first param>.helper()` is qualified by the enclosing class.
tests/test_python_receiver.py:31
Checks
assert _scopes(src)["helper"] == ("Foo.helper", "")
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured |
Source · 6 lines
def test_the_first_parameter_is_the_receiver(receiver: str) -> None:
"""@brief `<first param>.helper()` is qualified by the enclosing class."""
src = f"class Foo:\n def run({receiver}):\n {receiver}.helper()\n"
assert _scopes(src)["helper"] == ("Foo.helper", "")