mirror of
https://github.com/dh1tw/pyhamtools.git
synced 2025-12-06 06:52:00 +01:00
rais KeyError when callsign contains non latin characters
for example, cyrillic letter
This commit is contained in:
parent
bfbd0776bb
commit
077b645efe
|
|
@ -214,7 +214,10 @@ class Callinfo(object):
|
|||
pfx = re.sub('/', '', pfx.group(0))
|
||||
#make sure that the remaining part is actually a callsign (avoid: OZ/JO81)
|
||||
rest = re.search('/[A-Z0-9]+', entire_callsign)
|
||||
rest = re.sub('/', '', rest.group(0))
|
||||
if rest is None:
|
||||
self._logger.warning("non latin characters in callsign '{0}'".format(entire_callsign))
|
||||
raise KeyError
|
||||
rest = re.sub('/', '', rest.group(0))
|
||||
if re.match('^[\\d]{0,1}[A-Z]{1,2}\\d([A-Z]{1,4}|\\d{3,3}|\\d{1,3}[A-Z])[A-Z]{0,5}$', rest):
|
||||
return self._iterate_prefix(pfx)
|
||||
|
||||
|
|
|
|||
|
|
@ -265,6 +265,15 @@ class Test_callinfo_methods:
|
|||
fix_callinfo._dismantle_callsign("OZ/JO85")
|
||||
|
||||
|
||||
def test_dismantle_callsign_with_cyrillic_characters(self, fix_callinfo):
|
||||
|
||||
with pytest.raises(KeyError):
|
||||
fix_callinfo._dismantle_callsign("RД3MAS") #cyrillic letter 'Д' in call
|
||||
with pytest.raises(KeyError):
|
||||
fix_callinfo._dismantle_callsign("RД3/K9MAS") #cyrillic letter 'Д' in prefix
|
||||
with pytest.raises(KeyError):
|
||||
fix_callinfo._dismantle_callsign("R2EA/М") #cyrillic letter 'M' in appendix
|
||||
|
||||
def test_dismantle_callsign_with_VK9_special_suffixes(self, fix_callinfo):
|
||||
|
||||
if fix_callinfo._lookuplib._lookuptype == "clublog":
|
||||
|
|
|
|||
Loading…
Reference in a new issue