diff options
| author | Dave Hibberd <hibby@debian.org> | 2024-02-24 13:47:27 +0000 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2024-02-24 13:47:27 +0000 |
| commit | fc438e6a84402e621877f6c30097442af46f122b (patch) | |
| tree | 7a6ca4af4159368f92d10c6c932c4b5e662715aa /tests/unit/test_csv.py | |
| parent | 99bce70f3ca5cea0eb28f5158cfa00803cf6a19a (diff) | |
New upstream version 20240224upstream/20240224
Diffstat (limited to 'tests/unit/test_csv.py')
| -rw-r--r-- | tests/unit/test_csv.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/test_csv.py b/tests/unit/test_csv.py index 68bbcb9..c8428b0 100644 --- a/tests/unit/test_csv.py +++ b/tests/unit/test_csv.py @@ -72,6 +72,24 @@ class TestCSV(unittest.TestCase): self.assertEqual('5.0W', str(mem.power)) self.assertIn('UHF calling', mem.comment) + def test_csv_with_comments(self): + lines = list(CHIRP_CSV_MODERN.strip().split('\n')) + lines.insert(0, '# This is a comment') + lines.insert(0, '# Test file with comments') + lines.insert(4, '# Test comment in the middle') + lines.append('# Comment at the end') + with open(self.testfn, 'w', newline='') as f: + f.write('\r\n'.join(lines)) + csv = generic_csv.CSVRadio(self.testfn) + mem = csv.get_memory(0) + self.assertEqual(146520000, mem.freq) + mem = csv.get_memory(1) + self.assertEqual(446000000, mem.freq) + csv.save(self.testfn) + with open(self.testfn, 'r') as f: + read_lines = [x.strip() for x in f.readlines()] + self.assertEqual(lines, read_lines) + def test_parse_modern_bom(self): self.test_parse_modern(output_encoding='utf-8-sig') |
