diff options
| author | Dave Hibberd <hibby@debian.org> | 2024-02-24 13:47:31 +0000 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2024-02-24 13:47:31 +0000 |
| commit | 22d82ba3c0d6bd591c135290d88adcc2414ba588 (patch) | |
| tree | 98dacd9f46560513d2869207b7f13a8ca9294ba2 /tests/unit/test_csv.py | |
| parent | e5819ceb55106d4b9b8d34d4d4e031b2a895b760 (diff) | |
| parent | fc438e6a84402e621877f6c30097442af46f122b (diff) | |
Update upstream source from tag 'upstream/20240224'
Update to upstream version '20240224'
with Debian dir f7af8ad341f9d73e94489b1e0a1b6e721fc7f61d
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') |
