From 84fdba129a12ec9993e19b3a5636803c60848d81 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 8 Aug 2015 12:57:54 +0200 Subject: [PATCH] More style changes. --- _pytest/python.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_pytest/python.py b/_pytest/python.py index 36f3fb6ba..b7c102a69 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -23,6 +23,8 @@ isclass = inspect.isclass callable = py.builtin.callable # used to work around a python2 exception info leak exc_clear = getattr(sys, 'exc_clear', lambda: None) +# The type of re.compile objects is not exposed in Python. +REGEX_TYPE = type(re.compile('')) def filter_traceback(entry): return entry.path != cutdir1 and not entry.path.relto(cutdir2) @@ -983,16 +985,14 @@ def _idval(val, argname, idx, idfn): except ImportError: # Only available in Python 3.4+ enum = None - # The type of re.compile objects is not exposed in Python. - RegexType = type(re.compile('')) if isinstance(val, (float, int, str, bool, NoneType)): return str(val) - elif isinstance(val, RegexType): + elif isinstance(val, REGEX_TYPE): return val.pattern elif enum is not None and isinstance(val, enum.Enum): return str(val) - elif inspect.isclass(val) and hasattr(val, '__name__'): + elif isclass(val) and hasattr(val, '__name__'): return val.__name__ return str(argname)+str(idx)