summaryrefslogtreecommitdiff
path: root/tests/unit/test_chirp_common.py
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2024-08-27 23:17:59 +0100
committerDave Hibberd <hibby@debian.org>2024-08-27 23:17:59 +0100
commitea5898c0bff9b0b52c87408027880f5d7049bdec (patch)
tree2d76776f577a99039e0618ae6d8d26014d7c8e8f /tests/unit/test_chirp_common.py
parent0496ffac85e663ba4c9a14d2d4eb300a3c017ae2 (diff)
New upstream version 20240827upstream/20240827
Diffstat (limited to 'tests/unit/test_chirp_common.py')
-rw-r--r--tests/unit/test_chirp_common.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/unit/test_chirp_common.py b/tests/unit/test_chirp_common.py
index 9fe90ff..458a126 100644
--- a/tests/unit/test_chirp_common.py
+++ b/tests/unit/test_chirp_common.py
@@ -574,7 +574,8 @@ class TestImageMetadata(base.BaseTest):
f.write(b'thisisrawdata')
f.flush()
- with mock.patch('chirp.memmap.MemoryMap') as mock_mmap:
+ with mock.patch('chirp.memmap.MemoryMapBytes.__init__') as mock_mmap:
+ mock_mmap.return_value = None
chirp_common.CloneModeRadio(None).load_mmap(fn)
mock_mmap.assert_called_once_with(b'thisisrawdata')
os.remove(fn)
@@ -586,7 +587,8 @@ class TestImageMetadata(base.BaseTest):
f.write(chirp_common.CloneModeRadio.MAGIC + b'bad')
f.flush()
- with mock.patch('chirp.memmap.MemoryMap') as mock_mmap:
+ with mock.patch('chirp.memmap.MemoryMapBytes.__init__') as mock_mmap:
+ mock_mmap.return_value = None
chirp_common.CloneModeRadio(None).load_mmap(fn)
mock_mmap.assert_called_once_with(b'thisisrawdata')
os.remove(fn)
@@ -753,6 +755,12 @@ class TestCloneModeExtras(base.BaseTest):
class TestOverrideRules(base.BaseTest):
# You should not need to add your radio to this list. If you think you do,
# please ask permission first.
+ # Immutable fields should really only be used for cases where the value
+ # is not changeable based on the *location* of the memory. If something
+ # is forced to be a value based on the *content* of the memory (i.e. AM
+ # for frequencies in airband), coerce them on set/get, and return a
+ # ValidationWarning in validate_memory() so the user is told that the
+ # values are being forced.
IMMUTABLE_WHITELIST = [
# Uncomment me when the time comes
'Baofeng_GT-5R',