parametrize: allow __name__ id for modules or other objects as well
This commit is contained in:
parent
6ad95716da
commit
c22ce1a12c
|
@ -1162,7 +1162,8 @@ def _idval(val, argname, idx, idfn, item, config):
|
|||
return ascii_escaped(val.pattern)
|
||||
elif isinstance(val, enum.Enum):
|
||||
return str(val)
|
||||
elif (inspect.isclass(val) or inspect.isfunction(val)) and hasattr(val, "__name__"):
|
||||
elif hasattr(val, "__name__") and isinstance(val.__name__, str):
|
||||
# name of a class, function, module, etc.
|
||||
return val.__name__
|
||||
return str(argname) + str(idx)
|
||||
|
||||
|
|
Loading…
Reference in New Issue