From ffe4bcfaa6cfbd95ba47315f8f71a206485af6ae Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 30 Jan 2022 17:59:56 +0200 Subject: [PATCH] Remove deprecated VERSION, use __version__ instead --- src/humanize/__init__.py | 22 ---------------------- tests/test_humanize.py | 16 ---------------- 2 files changed, 38 deletions(-) delete mode 100644 tests/test_humanize.py diff --git a/src/humanize/__init__.py b/src/humanize/__init__.py index da5852f..af593d7 100644 --- a/src/humanize/__init__.py +++ b/src/humanize/__init__.py @@ -1,8 +1,5 @@ """Main package for humanize.""" -import sys -import warnings - from humanize.filesize import naturalsize from humanize.i18n import activate, deactivate, thousands_separator from humanize.number import ( @@ -32,25 +29,6 @@ __version__ = importlib_metadata.version(__name__) -if sys.version_info >= (3, 7): - # This technique isn't available for 3.6 but we don't need to warn for 3.6 - # because we'll drop 3.6 at the same time as removing this - def __getattr__(name): - if name == "VERSION": - warnings.warn( - "VERSION is deprecated and will be removed in humanize 4.0. " - "Use __version__ instead, available since humanize 1.0 (Feb 2020).", - DeprecationWarning, - stacklevel=2, - ) - return __version__ - raise AttributeError(f"module '{__name__}' has no attribute '{name}'") - - -else: - VERSION = __version__ - - __all__ = [ "__version__", "activate", diff --git a/tests/test_humanize.py b/tests/test_humanize.py deleted file mode 100644 index f77f90e..0000000 --- a/tests/test_humanize.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Other tests.""" -import sys - -import pytest - -import humanize - - -def test_version(): - if sys.version_info >= (3, 7): - with pytest.warns(DeprecationWarning): - VERSION = humanize.VERSION - else: - VERSION = humanize.VERSION - - assert VERSION == humanize.__version__