diff --git a/gribapi/errors.py b/gribapi/errors.py index 520d223..891a2ac 100644 --- a/gribapi/errors.py +++ b/gribapi/errors.py @@ -26,7 +26,7 @@ class GribInternalError(Exception): def __init__(self, value): # Call the base class constructor with the parameters it needs Exception.__init__(self, value) - if type(value) is int: + if isinstance(value, int): self.msg = ffi.string(lib.grib_get_error_message(value)).decode(ENC) else: self.msg = value diff --git a/tests/test_eccodes.py b/tests/test_eccodes.py index 66279d6..a088be8 100644 --- a/tests/test_eccodes.py +++ b/tests/test_eccodes.py @@ -58,11 +58,11 @@ def test_codes_set_samples_path(): def test_api_version(): vs = eccodes.codes_get_api_version() - assert type(vs) is str + assert isinstance(vs, str) assert len(vs) > 0 assert vs == eccodes.codes_get_api_version(str) vi = eccodes.codes_get_api_version(int) - assert type(vi) is int + assert isinstance(vi, int) assert vi > 20000 print(vi)