Do not mutate enum.Enum
Enums are meant to be symbolic names for rather arbitrary values. Therefore, these values shouldn't be spared from mutating anyway.
Actually, code like the following
class DirState(enum.Enum):
NOT_EXISTING = 1
NO_DIR = 2
OK = 98
UNKNOWN = 99
gets mutated pretty fair, with assigned values being modified at mutation time.
But with enums, the assigned values itself are not of interest. Actually, mutmut generates lots of happy surviving mutants from tests and code alike that.
If they are irrelevant, why do they have specific values and not just auto?
@boxed Thank you for pointing this out, I wasn't aware of this! Many thanks!
Setting values using enum.auto() wipes some mutations. Still, some mutations survive:
- NO_DIR = enum.auto()
+ NO_DIR = None
By now my only idea to wipe these too is to add assertions alike get_state('foo-bar').value is not None.
This kills eventually any enum-related mutants.
It's strange to ensure the special value None not since I didn't want to care for values at all, isn't it?
Hmm. Maybe. But you could have a simple test to ensure none of the Enum states are None too, which would kill all those mutants.