-
Notifications
You must be signed in to change notification settings - Fork 145
Description
With the changes in #469 mutations to default arguments will have no effect and thus always be reported (TODO: test this, add E2E test).
We probably could use decorators to handle this case:
def check(some_flag: bool = False) -> None:
return some_flagCould mutate to something like
@__mutmut_dispatcher(_mutations_dict)
def check(some_flag: bool = False) -> None:
return some_flagAnd depending on the os.environ['MUTANT_UNDER_TEST'] the @__mutmut_dispatcher would pass the args to the original function or the mutated method. The decorator could use *args, **kwargs as parameters and thus accept any args (with or without defaults).
I also like that with the decorator we would not need to do parsing of the args and handle all edge cases ourselve, but simply pass on *args, **kwargs.
For static typing, I think using ParamSpec should retain the original signature for static typing.
But I'm not sure how it works with runtime type hints. Maybe with a @functool.wraps decorator this is fine?