You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently when cover reaches an exception either from assertion or thrown by code directly it is materialized in test in form of
statement like
It would be more informative if in case of "named" assertion we get match parameter in generated test like below:
EXAMPLE2
deftest_named_assertion_error():
withpytest.raises(AssertionError,
match='This is assertion error that should appear in test case match - second checkpoint'):
named_assertion_error(101)
the above was generated without patch (EXAMPLE 1) as is now in version 0.0.42 and after applying patch (EXAMPLE2):
Code under test was:
defnamed_assertion_error(a: int):
asserta>100, "This is assertion error that should appear in test case match - first checkpoint"asserta>160, "This is assertion error that should appear in test case match - second checkpoint"
Describe the solution you'd like
Example solution would be to amend path_cover.py file in few places - described in link below.
Patch is available here, may require review and unit tests extension.
I'll also include some of our gitter discussion about this feature here for a historical record:
I can imagine cases where the user would prefer the test case to not be tied to the exception message. It seems like Pynguin only checks the exception type. We could make the behavior configurable. But I think it's reasonable to simply always check the message. One way of thinking about it: the test generation is always more specific than you might want. It's easier to trim out the parts you don't want to check than to add them. And the same reasoning applies whether you're checking an exception or a returned data structure.
Is your feature request related to a problem? Please describe.
Currently when cover reaches an exception either from assertion or thrown by code directly it is materialized in test in form of
statement like
EXAMPLE 1
It would be more informative if in case of "named" assertion we get match parameter in generated test like below:
EXAMPLE2
the above was generated without patch (EXAMPLE 1) as is now in version 0.0.42 and after applying patch (EXAMPLE2):
Code under test was:
Describe the solution you'd like
Example solution would be to amend path_cover.py file in few places - described in link below.
Patch is available here, may require review and unit tests extension.
Examples repository is here:
https://github.com/azewiusz/for-crosshair-tool/blob/main/example2/README.md
Describe alternatives you've considered
No clear alternatives, did this proposal to make certain analysis types easier.
The text was updated successfully, but these errors were encountered: