mirror of
https://github.com/kk7ds/chirp.git
synced 2024-09-21 18:47:18 +00:00
Check mem.extra structure when comparing memories
This makes us include the *structure* of mem.extra in the assertEqualMems() check to make sure it doesn't change before and after a modification.
This commit is contained in:
parent
1ccf039871
commit
ad73f0b53f
@ -43,11 +43,6 @@ class DriverTest(unittest.TestCase):
|
||||
# use that as our template instead of constructing a memory ourselves
|
||||
try:
|
||||
m = self.radio.get_memory(1)
|
||||
# Don't return extra because it will never match properly
|
||||
try:
|
||||
del m.extra
|
||||
except AttributeError:
|
||||
pass
|
||||
# Pre-filter the name so it will match what we expect back
|
||||
if 'name' not in m.immutable:
|
||||
m.name = self.radio.filter_name(m.name)
|
||||
@ -129,6 +124,8 @@ class DriverTest(unittest.TestCase):
|
||||
continue
|
||||
if k == "power":
|
||||
continue # FIXME
|
||||
elif k == "extra":
|
||||
continue
|
||||
elif k == "immutable":
|
||||
continue
|
||||
elif k == "name":
|
||||
@ -180,6 +177,16 @@ class DriverTest(unittest.TestCase):
|
||||
self.assertEqual(a_vals, b_vals,
|
||||
'Memories have unexpected differences')
|
||||
|
||||
# Consider mem.extra as matching if the structure remains the same.
|
||||
# Since we don't know anything about model-specific things here we
|
||||
# can't really assert any more than that, but we can ensure that the
|
||||
# structure doesn't change due to the contents of the rest of the
|
||||
# memory.
|
||||
if a.extra and b.extra:
|
||||
self.assertEqual([x.get_name() for x in a.extra],
|
||||
[x.get_name() for x in b.extra],
|
||||
'Memories have different mem.extra keys')
|
||||
|
||||
|
||||
def requires_feature(flag):
|
||||
def inner(fn):
|
||||
|
@ -1,4 +1,3 @@
|
||||
import copy
|
||||
import logging
|
||||
|
||||
from chirp import chirp_common
|
||||
@ -158,7 +157,7 @@ class TestCaseBruteForce(base.DriverTest):
|
||||
for mode in self.rf.valid_modes:
|
||||
self.assertIn(mode, chirp_common.MODES,
|
||||
'Radio exposes non-standard mode')
|
||||
tmp = copy.deepcopy(m)
|
||||
tmp = m.dupe()
|
||||
if mode == "DV" and \
|
||||
isinstance(self.radio,
|
||||
chirp_common.IcomDstarSupport):
|
||||
|
@ -6,3 +6,6 @@
|
||||
# One line per test nodeid with a comment above citing a bug number, example:
|
||||
# Bug #10931: FT-450 mem.extra fields cause UI corruption
|
||||
# tests/test_drivers.py::TestCaseBruteForce_Yaesu_FT-450D::test_mode
|
||||
|
||||
# Bug #10931: FT-450 mem.extra fields cause UI corruption
|
||||
tests/test_drivers.py::TestCaseBruteForce_Yaesu_FT-450D::test_mode
|
||||
|
Loading…
Reference in New Issue
Block a user