fix: remove dead-code Python version guard in utils/__init__.py (#270)

The guard:
    if sys.version_info.major == 3 and sys.version_info.minor >= 3:
        from collections.abc import MutableMapping
    else:
        from collections.abc import MutableMapping

has identical branches — both import from collections.abc (the correct
Python 3.3+ location).  Remove the guard; keep the bare import.

Closes #251
This commit is contained in:
2026-08-28 14:23:58 -04:00
committed by GitHub
parent 0063cc13c0
commit 7a2ed79759
3 changed files with 22 additions and 5 deletions
+19
View File
@@ -323,3 +323,22 @@ class TestUtils(unittest.TestCase):
level, msg = utils._check_version()
self.assertEqual(level, 1)
self.assertEqual(msg, 'New version available')
class TestDeadCodeRemoval(unittest.TestCase):
"""Regression tests for dead code that was removed."""
def test_mutable_mapping_importable(self):
"""MutableMapping must be importable from aprsd.utils after dead-code removal.
The version guard
if sys.version_info.major == 3 and sys.version_info.minor >= 3:
from collections.abc import MutableMapping
else:
from collections.abc import MutableMapping
had both branches do the same thing. After removing the guard the import
must still succeed on all supported Python versions.
"""
from aprsd.utils import MutableMapping as MM # noqa: N814
self.assertTrue(issubclass(dict, MM))