summaryrefslogtreecommitdiff
path: root/tests/unit/test_chirp_common.py
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2026-10-31 12:31:46 +0000
committerDave Hibberd <hibby@debian.org>2026-10-31 12:31:46 +0000
commitdd07cc494d2f8a342ee0556a593b068800f9da5b (patch)
tree07f455fe694b4a47959b76e9f93c0306690bc6a2 /tests/unit/test_chirp_common.py
parentaa0d17d5ad14d671e5ce02cb90f814e0a96fad98 (diff)
parentef0af95bac2c3d310fe55f54853904395b57f884 (diff)
Update upstream source from tag 'upstream/20261030'
Update to upstream version '20261030' with Debian dir 82dda47c52fda693a8e3b8228e4043c187b8dcfc
Diffstat (limited to 'tests/unit/test_chirp_common.py')
-rw-r--r--tests/unit/test_chirp_common.py53
1 files changed, 45 insertions, 8 deletions
diff --git a/tests/unit/test_chirp_common.py b/tests/unit/test_chirp_common.py
index e4c2556..4b7cda5 100644
--- a/tests/unit/test_chirp_common.py
+++ b/tests/unit/test_chirp_common.py
@@ -72,11 +72,9 @@ class TestUtilityFunctions(base.BaseTest):
self.assertTrue(chirp_common.is_version_newer('daily-20180101'))
def test_from_Hz(self):
- # FIXME: These are wrong! Adding them here purely to test the
- # python3 conversion, but they should be fixed.
- self.assertEqual(140, chirp_common.from_GHz(14000000001))
- self.assertEqual(140, chirp_common.from_MHz(14000001))
- self.assertEqual(140, chirp_common.from_kHz(14001))
+ self.assertEqual(140, chirp_common.from_GHz(140000000001))
+ self.assertEqual(140, chirp_common.from_MHz(140000001))
+ self.assertEqual(140, chirp_common.from_kHz(140001))
def test_mem_to_from_csv(self):
mem1 = chirp_common.Memory()
@@ -562,10 +560,10 @@ class TestStepFunctions(base.BaseTest):
chirp_common.fix_rounded_step(146520000))
def test_fix_rounded_step_833(self):
- # 108.008 should be aligned to 8.33kHz step
+ # 118.008 should be aligned to 8.33kHz step
self.assertEqual(
- int(108000000 + (25000 / 3)),
- chirp_common.fix_rounded_step(chirp_common.to_MHz(108.008)))
+ int(118000000 + (25000 / 3)),
+ chirp_common.fix_rounded_step(chirp_common.to_MHz(118.008)))
# 108.0 MHz should be left unchanged as it is 25kHz-aligned
self.assertFalse(chirp_common.is_8_33(
@@ -590,6 +588,45 @@ class TestStepFunctions(base.BaseTest):
chirp_common.fix_rounded_step,
chirp_common.to_MHz(146.008333))
+ # Using a channel name should be aligned to the actual frequency
+ self.assertEqual(
+ int(132050000),
+ chirp_common.fix_rounded_step(chirp_common.to_MHz(132.055)))
+ self.assertEqual(
+ int(132050000) + (25000 // 3),
+ chirp_common.fix_rounded_step(chirp_common.to_MHz(132.060)))
+ self.assertEqual(
+ int(132050000) + (25000 // 3) * 2,
+ chirp_common.fix_rounded_step(chirp_common.to_MHz(132.065)))
+ self.assertEqual(
+ int(132075000),
+ chirp_common.fix_rounded_step(chirp_common.to_MHz(132.080)))
+
+ # This is not valid
+ self.assertRaisesRegex(errors.InvalidDataError,
+ 'Aircraft frequencies must be aligned.*',
+ chirp_common.fix_rounded_step,
+ chirp_common.to_MHz(132.070))
+
+ def test_fix_rounded_step_833_examples(self):
+ # https://ukradiotransmissions.wordpress.com/2019/02/06/new-8-33khz-airband-channel-spacing-frequencies-a-conversion-chart-and-explanation/
+ cases = [
+ (132005000, 132000000),
+ (132010000, 132008300),
+ (132015000, 132016600),
+ (132030000, 132025000),
+ (132035000, 132033300),
+ (132040000, 132041600),
+ (132055000, 132050000),
+ (132060000, 132058300),
+ (132065000, 132066600),
+ (132080000, 132075000),
+ (132085000, 132083300),
+ (132090000, 132091600),
+ ]
+ for channel, freq in cases:
+ pass
+
class TestImageMetadata(base.BaseTest):
def test_make_metadata(self):