diff --git a/tests/common/cache/facts_cache.py b/tests/common/cache/facts_cache.py index c40e5f9ff0..3b3c5504cb 100644 --- a/tests/common/cache/facts_cache.py +++ b/tests/common/cache/facts_cache.py @@ -205,7 +205,7 @@ def _get_default_zone(function, func_args, func_kargs): unicode_type = str if sys.version_info.major >= 3 else unicode # noqa: F821 if func_args: hostname = getattr(func_args[0], "hostname", None) - if not hostname or type(hostname) not in [str, unicode_type]: + if not hostname or not isinstance(hostname, (str, unicode_type)): raise ValueError("Failed to get attribute 'hostname' of type string from instance of type %s." % type(func_args[0])) zone = hostname