From ab759fd4b2dd13b5f0cadfc7ef21e3e8f893a95a Mon Sep 17 00:00:00 2001 From: ciorceri Date: Thu, 6 Sep 2018 22:55:50 +0300 Subject: [PATCH] Fixed bug when comparing an uppercase with an lowercase QTH locator --- edi.py | 6 +++--- test_edi.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/edi.py b/edi.py index ae1e6ed..dc45f37 100644 --- a/edi.py +++ b/edi.py @@ -976,13 +976,13 @@ def compare_qso(log1, qso1, log2, qso2): raise ValueError('Serial number mismatch') # compare qth - if log1.maidenhead_locator != qso2.qso_fields['wwl']: + if log1.maidenhead_locator.upper() != qso2.qso_fields['wwl'].upper(): raise ValueError('Qth locator mismatch (other ham)') - if log2.maidenhead_locator != qso1.qso_fields['wwl']: + if log2.maidenhead_locator.upper() != qso1.qso_fields['wwl'].upper(): raise ValueError('Qth locator mismatch') # calculate & return distance - return qth_distance(log1.maidenhead_locator, log2.maidenhead_locator) + return qth_distance(log1.maidenhead_locator.upper(), log2.maidenhead_locator.upper()) def mark_older_logs(log_list): diff --git a/test_edi.py b/test_edi.py index 31bc6f6..f4aee9c 100644 --- a/test_edi.py +++ b/test_edi.py @@ -1054,6 +1054,8 @@ def test_compare_qso(self, mock_isfile): edi.LogQso('130803;1200;YO5AAA;6;59;001;59;001;;ZZ16ZZ;1;;;;', 1, _rules), # qso with long serial (29) edi.LogQso('130803;1200;YO5AAA;6;59;0001;59;001;;KN16AA;1;;;;', 1, _rules), + # qso with lowercase qthlocator (30) + edi.LogQso('130803;1200;YO5AAA;6;59;0001;59;001;;KN16aa;1;;;;', 1, _rules), ] qso_test = ( @@ -1130,6 +1132,9 @@ def test_compare_qso(self, mock_isfile): # valid test with long serial (qso_list[0], qso_list[29], 1, None, None), (qso_list[29], qso_list[0], 1, None, None), + # valid test with lowercase qthlocator + (qso_list[0], qso_list[30], 1, None, None), + (qso_list[30], qso_list[0], 1, None, None), )