diff --git a/src/drf_yasg/inspectors/field.py b/src/drf_yasg/inspectors/field.py index 4d456fbf..05ff2842 100644 --- a/src/drf_yasg/inspectors/field.py +++ b/src/drf_yasg/inspectors/field.py @@ -193,7 +193,7 @@ def get_queryset_from_view(view, serializer=None): if queryset is not None and serializer is not None: # make sure the view is actually using *this* serializer - assert type(serializer) == call_view_method(view, 'get_serializer_class', 'serializer_class') + assert type(serializer) is call_view_method(view, 'get_serializer_class', 'serializer_class') return queryset except Exception: # pragma: no cover diff --git a/src/drf_yasg/openapi.py b/src/drf_yasg/openapi.py index 0a2cfb8f..9679c80d 100644 --- a/src/drf_yasg/openapi.py +++ b/src/drf_yasg/openapi.py @@ -88,7 +88,7 @@ class SwaggerDict(OrderedDict): def __init__(self, **attrs): super(SwaggerDict, self).__init__() self._extras__ = attrs - if type(self) == SwaggerDict: + if type(self) is SwaggerDict: self._insert_extras__() def __setattr__(self, key, value): @@ -516,7 +516,7 @@ def __init__(self, resolver, name, scope, expected_type, ignore_unresolved=False :param bool ignore_unresolved: do not throw if the referenced object does not exist """ super(_Ref, self).__init__() - assert not type(self) == _Ref, "do not instantiate _Ref directly" + assert not type(self) is _Ref, "do not instantiate _Ref directly" ref_name = "#/{scope}/{name}".format(scope=scope, name=name) if not ignore_unresolved: obj = resolver.get(name, scope) diff --git a/src/drf_yasg/utils.py b/src/drf_yasg/utils.py index 494ce48c..15d18ac4 100644 --- a/src/drf_yasg/utils.py +++ b/src/drf_yasg/utils.py @@ -442,7 +442,7 @@ def force_real_str(s, encoding='utf-8', strings_only=False, errors='strict'): """ if s is not None: s = force_str(s, encoding, strings_only, errors) - if type(s) != str: + if type(s) is not str: s = '' + s # Remove common indentation to get the correct Markdown rendering