summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2025-02-27 20:48:04 +0000
committerDave Hibberd <hibby@debian.org>2025-02-27 20:48:04 +0000
commitc3da928780ee3025b380cbaf536d79d29d77606a (patch)
tree32d46db09290bd0f2d5e3d050b27e9f6656a8463 /tests
parent03708fb51a1b7f28fc2dd2f55d40e44003b8d90a (diff)
parentf6b2e6e7159906b8b3204dca3a9e58e42c36ccbb (diff)
Update upstream source from tag 'upstream/20250221'
Update to upstream version '20250221' with Debian dir 7954287a4b4113b0b031dad53aacb7a1c4bdccd7
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py43
-rw-r--r--tests/__pycache__/__init__.cpython-310.pycbin3265 -> 4271 bytes
-rw-r--r--tests/__pycache__/base.cpython-310.pycbin5318 -> 5375 bytes
-rw-r--r--tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pycbin5396 -> 6661 bytes
-rw-r--r--tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pycbin7385 -> 7719 bytes
-rw-r--r--tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pycbin2445 -> 2547 bytes
-rw-r--r--tests/base.py5
-rw-r--r--tests/driver_xfails.yaml107
-rw-r--r--tests/images/Baofeng_UV-5R.imgbin6472 -> 6661 bytes
-rw-r--r--tests/images/Icom_IC-F621-2.imgbin0 -> 12521 bytes
-rw-r--r--tests/images/Kenwood_TK-280.imgbin0 -> 32957 bytes
-rw-r--r--tests/images/Kenwood_TK-481.imgbin0 -> 32969 bytes
-rw-r--r--tests/images/Kenwood_TK-880.imgbin0 -> 32989 bytes
-rwxr-xr-xtests/images/Kenwood_TK-981.imgbin0 -> 33033 bytes
-rw-r--r--tests/images/Radioddity_GA-510_V2.imgbin20673 -> 20673 bytes
-rw-r--r--tests/images/Retevis_H777H_FRS.imgbin0 -> 1205 bytes
-rw-r--r--tests/images/Retevis_RB626.imgbin0 -> 969 bytes
-rw-r--r--tests/images/Yaesu_VX-7.imgbin16211 -> 16380 bytes
-rw-r--r--tests/py3-untested-drivers.txt1
-rw-r--r--tests/py3_driver_testers.txt2
-rw-r--r--tests/test_brute_force.py31
-rw-r--r--tests/test_edges.py16
-rw-r--r--tests/test_settings.py3
-rw-r--r--tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pycbin16962 -> 18507 bytes
-rw-r--r--tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pycbin8032 -> 8070 bytes
-rw-r--r--tests/unit/test_bitwise.py32
-rw-r--r--tests/unit/test_chirp_common.py23
-rw-r--r--tests/unit/test_repeaterbook.py5
28 files changed, 263 insertions, 5 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index d076136..b2563b8 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,9 +1,12 @@
+import functools
import glob
import logging
import os
+from types import FunctionType
import unittest
import pytest
+import yaml
from chirp import directory
@@ -20,7 +23,28 @@ LOG = logging.getLogger('testadapter')
class TestAdapterMeta(type):
+ """Generate a subclass of a TestCase for our radio.
+
+ This wraps each of the test functions so they can be marked by pytest
+ independently.
+
+ Only works with a single parent!
+ """
def __new__(cls, name, parents, dct):
+ for attrname, attr in list(parents[0].__dict__.items()):
+ if (isinstance(attr, FunctionType) and
+ attrname.startswith('test') and
+ not hasattr(attr, 'pytestmark')):
+ # This is our wrapper, just so it can be independently marked
+ # by pytest without affecting the parent class
+ @functools.wraps(attr)
+ def wrapper(self, name, *a, **k):
+ # This is a hacky super() replacement
+ return getattr(parents[0], name)(self, *a, **k)
+
+ # Make this an override in the child class
+ dct[attrname] = functools.partialmethod(wrapper, attrname)
+
return super(TestAdapterMeta, cls).__new__(cls, name, parents, dct)
@@ -73,6 +97,10 @@ def _load_tests(loader, tests, pattern, suite=None):
test_features.TestCaseFeatures,
test_copy_all.TestCaseCopyAll)
+ # Load our list of dynamic XFAIL tests
+ with open('tests/driver_xfails.yaml') as xflist:
+ xfail_list = yaml.load(xflist, Loader=yaml.SafeLoader)
+
for image, test in tests.items():
rclass = directory.get_radio(test)
if hasattr(rclass, '_orig_rclass'):
@@ -83,16 +111,27 @@ def _load_tests(loader, tests, pattern, suite=None):
for index, device in enumerate(subdevs):
if not isinstance(device, type):
device = device.__class__
+ rclassid = directory.radio_class_id(device)
+ xfails = xfail_list.get(rclassid, [])
for case in driver_test_cases:
tc = TestAdapterMeta(
- "%s_%s" % (case.__name__,
- directory.radio_class_id(device)),
+ "%s_%s" % (case.__name__, rclassid),
(case,),
{'RADIO_CLASS': rclass,
'SUB_DEVICE': index if has_subdevs else None,
'TEST_IMAGE': image})
+ # Mark the class with the driver module name
tc = getattr(pytest.mark, module)(tc)
+
+ # Look for any XFAILs and mark those test functions
+ for xfail in xfails:
+ if xfail['class'] == case.__name__:
+ # This is like decorating it.
+ setattr(tc, xfail['test'],
+ pytest.mark.xfail(reason=xfail['reason'])(
+ getattr(tc, xfail['test'])))
+
suite.addTests(loader.loadTestsFromTestCase(tc))
return suite
diff --git a/tests/__pycache__/__init__.cpython-310.pyc b/tests/__pycache__/__init__.cpython-310.pyc
index e42885a..e5edb17 100644
--- a/tests/__pycache__/__init__.cpython-310.pyc
+++ b/tests/__pycache__/__init__.cpython-310.pyc
Binary files differ
diff --git a/tests/__pycache__/base.cpython-310.pyc b/tests/__pycache__/base.cpython-310.pyc
index e20be95..0d22964 100644
--- a/tests/__pycache__/base.cpython-310.pyc
+++ b/tests/__pycache__/base.cpython-310.pyc
Binary files differ
diff --git a/tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc
index 5691216..7cd6a5e 100644
--- a/tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc
+++ b/tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc
Binary files differ
diff --git a/tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc
index f6922f0..47421f6 100644
--- a/tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc
+++ b/tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc
Binary files differ
diff --git a/tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc
index fc0c17c..5ce354a 100644
--- a/tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc
+++ b/tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc
Binary files differ
diff --git a/tests/base.py b/tests/base.py
index c2033aa..af29310 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -214,11 +214,12 @@ class DriverTest(unittest.TestCase):
'Memories have different mem.extra keys')
-def requires_feature(flag):
+def requires_feature(flag, equal=None):
def inner(fn):
@functools.wraps(fn)
def wraps(self, *a, **k):
- if getattr(self.rf, flag):
+ val = getattr(self.rf, flag)
+ if (val == equal if equal is not None else val):
fn(self, *a, **k)
else:
self.skipTest('Feature %s not supported' % flag)
diff --git a/tests/driver_xfails.yaml b/tests/driver_xfails.yaml
new file mode 100644
index 0000000..6064656
--- /dev/null
+++ b/tests/driver_xfails.yaml
@@ -0,0 +1,107 @@
+Anysecu_UV-A37:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Broken name stored in memory 202?
+Talkpod_A36plus:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Broken name stored in memory 202?
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+BTECH_GMRS-20V2:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Improper application of the duplex policy
+BTECH_GMRS-V2:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Improper application of the duplex policy
+BTECH_GMRS-50X1:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Improper application of the duplex policy
+BTECH_GMRS-50V2:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Improper application of the duplex policy
+BTECH_MURS-V2:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Improper application of the duplex policy
+Abbree_AR-730:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Broken name stored in memory 256?
+Radtel_RT-730:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Improper application of the duplex policy
+Retevis_RB17P:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Improper application of the duplex policy
+TIDRADIO_TD-H3:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Memory 3 stored with TX outside TX range
+TIDRADIO_TD-H8:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Memory 6 stored with TX outside TX range
+TIDRADIO_TD-H8-GMRS:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Memory 31 stored with TX outside gmrs bands
+TIDRADIO_TD-H8-HAM:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Memory 31 stored with TX outside ham bands
+Yaesu_FT-90:
+ - class: TestCaseBruteForce
+ test: test_validate_all
+ reason: Memory 7 stored with high power but unable to be set?
+Wouxun_KG-UVD1P:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+Puxing_PX-2R:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+Radtel_RT-470X_BT:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+BTECH_UV-25X4_G2:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+Abbree_AR-63:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+Feidaxin_FD-288B:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+Wouxun_KG-UV8E:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+Boblov_X3Plus:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+QYT_KT7900D:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+BTECH_UV-25X4:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
+Baojie_BJ-9900_Left:
+ - class: TestCaseBruteForce
+ test: test_validate_all_steps
+ reason: Bad channel stored in image or code is wrong
diff --git a/tests/images/Baofeng_UV-5R.img b/tests/images/Baofeng_UV-5R.img
index dcdc3e8..773c32b 100644
--- a/tests/images/Baofeng_UV-5R.img
+++ b/tests/images/Baofeng_UV-5R.img
Binary files differ
diff --git a/tests/images/Icom_IC-F621-2.img b/tests/images/Icom_IC-F621-2.img
new file mode 100644
index 0000000..fe86e99
--- /dev/null
+++ b/tests/images/Icom_IC-F621-2.img
Binary files differ
diff --git a/tests/images/Kenwood_TK-280.img b/tests/images/Kenwood_TK-280.img
new file mode 100644
index 0000000..f6bc6c1
--- /dev/null
+++ b/tests/images/Kenwood_TK-280.img
Binary files differ
diff --git a/tests/images/Kenwood_TK-481.img b/tests/images/Kenwood_TK-481.img
new file mode 100644
index 0000000..26e8eb5
--- /dev/null
+++ b/tests/images/Kenwood_TK-481.img
Binary files differ
diff --git a/tests/images/Kenwood_TK-880.img b/tests/images/Kenwood_TK-880.img
new file mode 100644
index 0000000..3b38b43
--- /dev/null
+++ b/tests/images/Kenwood_TK-880.img
Binary files differ
diff --git a/tests/images/Kenwood_TK-981.img b/tests/images/Kenwood_TK-981.img
new file mode 100755
index 0000000..cb613fb
--- /dev/null
+++ b/tests/images/Kenwood_TK-981.img
Binary files differ
diff --git a/tests/images/Radioddity_GA-510_V2.img b/tests/images/Radioddity_GA-510_V2.img
index 7695033..2c338a2 100644
--- a/tests/images/Radioddity_GA-510_V2.img
+++ b/tests/images/Radioddity_GA-510_V2.img
Binary files differ
diff --git a/tests/images/Retevis_H777H_FRS.img b/tests/images/Retevis_H777H_FRS.img
new file mode 100644
index 0000000..70a036a
--- /dev/null
+++ b/tests/images/Retevis_H777H_FRS.img
Binary files differ
diff --git a/tests/images/Retevis_RB626.img b/tests/images/Retevis_RB626.img
new file mode 100644
index 0000000..c4cb38a
--- /dev/null
+++ b/tests/images/Retevis_RB626.img
Binary files differ
diff --git a/tests/images/Yaesu_VX-7.img b/tests/images/Yaesu_VX-7.img
index 2542f8e..8a95099 100644
--- a/tests/images/Yaesu_VX-7.img
+++ b/tests/images/Yaesu_VX-7.img
Binary files differ
diff --git a/tests/py3-untested-drivers.txt b/tests/py3-untested-drivers.txt
index ac576c8..ae81485 100644
--- a/tests/py3-untested-drivers.txt
+++ b/tests/py3-untested-drivers.txt
@@ -35,7 +35,6 @@ Kenwood_TS-590S_SG_LiveMode
Kenwood_TS-850
Puxing_PX-2R
RT_Systems_CSV
-Rugged_RH5R-V2
Sainsonic_AP510
TYT_TH-350
TYT_TH-7800_File
diff --git a/tests/py3_driver_testers.txt b/tests/py3_driver_testers.txt
index a0aaa55..2925741 100644
--- a/tests/py3_driver_testers.txt
+++ b/tests/py3_driver_testers.txt
@@ -253,6 +253,8 @@ Radtel_RT-495,@KC9HI,14-Jun-2024
Radtel_RT-630,@KC9HI,14-Jun-2024
Radtel_RT-730,@KC9HI,11-May-2024
Radtel_T18,@KC9HI,28-Nov-2022
+Retevis_H777H_FRS,@KC9HI,12-Jan-2025
+Retevis_H777H_PMR,@KC9HI,12-Jan-2025
Retevis_H777S,@KC9HI,22-Dec-2022
Retevis_H777_Plus,@KC9HI,4-Dec-2022
Retevis_P2,@KC9HI,15-Jun-2024
diff --git a/tests/test_brute_force.py b/tests/test_brute_force.py
index eb5ea9b..f3bd68f 100644
--- a/tests/test_brute_force.py
+++ b/tests/test_brute_force.py
@@ -1,5 +1,7 @@
import logging
+import pytest
+
from chirp import chirp_common
from chirp import errors
from tests import base
@@ -190,3 +192,32 @@ class TestCaseBruteForce(base.DriverTest):
# in some radios
self.set_and_compare(tmp, ignore=['tuning_step'])
successes += 1
+
+ def test_validate_all(self):
+ lo, hi = self.rf.memory_bounds
+ for i in range(lo, hi + 1):
+ m1 = self.radio.get_memory(i)
+ errs, warns = chirp_common.split_validation_msgs(
+ self.radio.validate_memory(m1))
+ self.assertEqual([], errs,
+ ('Radio has validation errors for memory %i '
+ 'stored in sample image') % i)
+
+ @base.requires_feature('has_nostep_tuning', equal=False)
+ def test_validate_all_steps(self):
+ lo, hi = self.rf.memory_bounds
+ for i in range(lo, hi + 1):
+ m1 = self.radio.get_memory(i)
+ try:
+ chirp_common.required_step(m1.freq, self.rf.valid_tuning_steps)
+ except Exception as e:
+ self.fail('Memory %i: %s' % (i, e))
+
+ @pytest.mark.skip(reason='not ready yet')
+ def test_get_set_all(self):
+ lo, hi = self.rf.memory_bounds
+ for i in range(lo, hi + 1):
+ m1 = self.radio.get_memory(i)
+ self.radio.set_memory(m1)
+ m2 = self.radio.get_memory(i)
+ self.assertEqualMem(m1, m2)
diff --git a/tests/test_edges.py b/tests/test_edges.py
index b3391c4..c5c0775 100644
--- a/tests/test_edges.py
+++ b/tests/test_edges.py
@@ -107,6 +107,22 @@ class TestCaseEdges(base.DriverTest):
'to delete location %i' % loc)
break
+ def test_redelete_memory(self):
+ m = self.get_mem()
+ if 'empty' in m.immutable:
+ self.skipTest('Test memory is not deletable')
+
+ # Delete this memory
+ m.empty = True
+ self.radio.set_memory(m)
+
+ # Try to delete it again
+ self.radio.set_memory(m)
+
+ # Make sure it appears deleted
+ m2 = self.radio.get_memory(m.number)
+ self.assertTrue(m2.empty)
+
def test_get_set_specials(self):
if not self.rf.valid_special_chans:
self.skipTest('Radio has no specials')
diff --git a/tests/test_settings.py b/tests/test_settings.py
index 45267f0..2bcd302 100644
--- a/tests/test_settings.py
+++ b/tests/test_settings.py
@@ -35,6 +35,9 @@ class TestCaseSettings(base.DriverTest):
self.assertEqual(a.get_value(), b.get_value(),
'Setting value changed from %r to %r' % (
a.get_value(), b.get_value()))
+ except Exception as e:
+ print('Failed %s on %s' % (e, a.get_name()))
+ raise
def test_memory_extra_frozen(self):
# Find the first non-empty memory and try to set it back as a
diff --git a/tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc
index 9dcc2db..b65e7cd 100644
--- a/tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc
+++ b/tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc
Binary files differ
diff --git a/tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc
index 9676932..9c51168 100644
--- a/tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc
+++ b/tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc
Binary files differ
diff --git a/tests/unit/test_bitwise.py b/tests/unit/test_bitwise.py
index 4ba467f..dc38cb6 100644
--- a/tests/unit/test_bitwise.py
+++ b/tests/unit/test_bitwise.py
@@ -97,6 +97,21 @@ class TestBitwiseBaseIntTypes(BaseTest):
obj.foo[i] = i * 2
self.assertEqual(b'\x00\x02\x04\x06', data.get_packed())
+ def test_int_array_of_one(self):
+ data = memmap.MemoryMapBytes(bytes(b'\x00\x01\x02\x03'))
+ obj = bitwise.parse('u8 foo[1];', data)
+ self.assertEqual(0, obj.foo[0])
+ obj.foo[0] = 1
+ self.assertEqual(b'\x01\x01\x02\x03', data.get_packed())
+
+ def test_int_array_of_zero(self):
+ data = memmap.MemoryMapBytes(bytes(b'\x00\x01\x02\x03'))
+ obj = bitwise.parse('u8 foo[0x0]; u8 bar;', data)
+ # Make sure we can't access any elements of zero-length foo
+ self.assertRaises(IndexError, lambda: obj.foo[0])
+ # Make sure bar is still at the front, unaffected by zero-length foo
+ self.assertEqual(0, obj.bar)
+
def test_int_array_set_raw(self):
data = memmap.MemoryMapBytes(bytes(b'\x00\x01\x02\x03'))
obj = bitwise.parse('u8 foo[4];', data)
@@ -357,6 +372,12 @@ class TestBitwiseStructTypes(BaseTest):
self.assertRaises(AssertionError, obj.fill_raw, b'AB')
self.assertRaises(AssertionError, obj.fill_raw, False)
+ def test_struct_array_of_one(self):
+ data = memmap.MemoryMapBytes(bytes(b"123"))
+ defn = "struct { u8 bar; } foo[1];"
+ obj = bitwise.parse(defn, data)
+ self.assertEqual(ord('1'), obj.foo[0].bar)
+
class TestBitwisePrintoffset(BaseTest):
@mock.patch.object(bitwise.LOG, 'debug')
@@ -383,6 +404,17 @@ class TestBitwiseErrors(BaseTest):
def test_missing_semicolon(self):
self.assertRaises(SyntaxError, bitwise.parse, "u8 foo", "")
+ def test_missing_element(self):
+ obj = bitwise.parse('u8 foo; struct { u8 bar; } baz;', b'12')
+ self.assertRaisesRegex(AttributeError,
+ 'No attribute does_not_exist',
+ getattr, obj, 'does_not_exist')
+ self.assertRaisesRegex(AttributeError,
+ 'No attribute this_either',
+ getattr, obj.baz, 'this_either')
+ self.assertTrue('foo' in obj)
+ self.assertFalse('does_not_exist' in obj)
+
class TestBitwiseComments(BaseTest):
def test_comment_inline_cppstyle(self):
diff --git a/tests/unit/test_chirp_common.py b/tests/unit/test_chirp_common.py
index ea3bcf8..facdbed 100644
--- a/tests/unit/test_chirp_common.py
+++ b/tests/unit/test_chirp_common.py
@@ -78,6 +78,11 @@ class TestUtilityFunctions(base.BaseTest):
self.assertEqual(140, chirp_common.from_MHz(14000001))
self.assertEqual(140, chirp_common.from_kHz(14001))
+ def test_mem_to_from_csv(self):
+ mem1 = chirp_common.Memory()
+ mem2 = chirp_common.Memory._from_csv(','.join(mem1.to_csv()))
+ self.assertEqual(str(mem1), str(mem2))
+
def test_mem_from_text_rb1(self):
text = '145.2500 -0.6 MHz 97.4 OPEN'
mem = chirp_common.mem_from_text(text)
@@ -227,6 +232,24 @@ class TestUtilityFunctions(base.BaseTest):
self.assertEqual(150000000, mem.offset)
self.assertEqual('split', mem.duplex)
+ def test_mem_from_text_tsv(self):
+ from_lo = """8 Mt Scott 147.28 + 0.6 TSQL 88.5 167.9 23 NN 23 Tone->Tone FM 5 50W TayDan Emergency Step #2
+9 Mt Tabor 145.39 - 0.6 TSQL 88.5 100 23 NN 23 Tone->Tone FM 5 50W TayDan Emergency Step #1
+10 Timberline V 147.12 + 0.6 TSQL 103.5 100 23 NN 23 Tone->Tone FM 5 50W TayDan Emergency Step #4
+11 Timberline U 444.225 + 5 TSQL 88.5 100 23 NN 23 Tone->Tone FM 5 50W K7RPT Timberline, Linked to VHF side, AC7QE-R echolink
+12 GovtCamp 443.875 + 5 TSQL 88.5 103.5 23 NN 23 Tone->Tone FM 5 50W""" # noqa
+
+ lines = from_lo.split('\n')
+ mem = chirp_common.mem_from_text(lines[0])
+ self.assertEqual('Mt Scott', mem.name)
+ self.assertEqual('TSQL', mem.tmode)
+ self.assertEqual('+', mem.duplex)
+ self.assertEqual(600000, mem.offset)
+ self.assertEqual(147280000, mem.freq)
+ self.assertEqual(8, mem.number)
+ for line in from_lo.split('\n'):
+ chirp_common.mem_from_text(line)
+
def test_mem_to_text1(self):
mem = chirp_common.Memory()
mem.freq = 146900000
diff --git a/tests/unit/test_repeaterbook.py b/tests/unit/test_repeaterbook.py
index 8a0b059..57532fa 100644
--- a/tests/unit/test_repeaterbook.py
+++ b/tests/unit/test_repeaterbook.py
@@ -43,6 +43,7 @@ class TestRepeaterbook(unittest.TestCase):
'lon': coords[1],
'dist': 100,
'openonly': False,
+ 'cached': False,
})
m = rb.get_memory(0)
self.assertIsInstance(m, chirp_common.Memory)
@@ -81,6 +82,7 @@ class TestRepeaterbook(unittest.TestCase):
'dist': 100,
'service': 'gmrs',
'openonly': False,
+ 'cached': False,
})
m = rb.get_memory(0)
self.assertIsInstance(m, chirp_common.Memory)
@@ -102,6 +104,7 @@ class TestRepeaterbook(unittest.TestCase):
'lon': 133,
'dist': 20000,
'openonly': False,
+ 'cached': False,
})
m = rb.get_memory(0)
self.assertIsInstance(m, chirp_common.Memory)
@@ -122,6 +125,7 @@ class TestRepeaterbook(unittest.TestCase):
'lon': -122,
'dist': 0,
'openonly': False,
+ 'cached': False,
'filter': 'tower'}
rb = self._test_with_mocked(params)
self.assertGreater(sum(rb.get_features().memory_bounds), 5)
@@ -133,6 +137,7 @@ class TestRepeaterbook(unittest.TestCase):
'lon': -122,
'dist': 0,
'openonly': False,
+ 'cached': False,
'filter': 'tower'}
rb1 = self._test_with_mocked(dict(params))
self.assertGreater(sum(rb1.get_features().memory_bounds), 5)