-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
enhancementNew feature or requestNew feature or request
Description
There's this confusing _do_test function that I've duplicated throughout the tests. It ends up making a lot of the unit tests look like magic and doesn't necessarily help someone if they are using the unit tests to understand normal usage of the library.
def test_EchoWriteRequest() -> None:
_do_test(
smpos.EchoWriteRequest,
smphdr.OP.WRITE,
oscmd.ECHO,
{"d": "Hello world!"},
)Nothing is accessed, asserted, etc.
I feel like the tests themselves should be updated to at least show that the CBOR payload members are accessible as part of the type:
def test_EchoWriteRequest() -> None:
r = _do_test(
smpos.EchoWriteRequest,
smphdr.OP.WRITE,
oscmd.ECHO,
{"d": "Hello world!"},
)
assert r.d == "Hello world!"Further, _do_test should be generalized, rewritten with better variable names, comments etc. if the code cannot be made more legible, so that maintainers don't have to copy it to each test suite.
_do_test ITSELF should be unit tested if tests depend on it!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request