mirror of
https://github.com/craigerl/aprsd.git
synced 2026-09-08 12:35:29 -04:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user