added Callinfo; Lookup Info doesn't return now START, END, WHITELIST, WHITELIST_START and WHITELIST_END anymore

This commit is contained in:
dh1tw 2014-04-28 01:59:18 +02:00
parent 2017b1bf6d
commit ecf1b036e8
6 changed files with 455 additions and 56 deletions

View file

@ -1,3 +1,4 @@
from pyhamtools.lookuplib import LookupLib
from pyhamtools.callinfo import Callinfo

View file

@ -1,41 +1,207 @@
import re
import logging
from datetime import datetime
import pytz
from pyhamtools import LookupLib
from pyhamtools.consts import LookupConventions as const
UTC = pytz.UTC
timestamp_now = datetime.utcnow().replace(tzinfo=UTC)
class Callinfo(object):
"""
This is going to going to return information for a callsign
"""
def __init__(self, lookuplib):
pass
def __init__(self, lookuplib=LookupLib(), logger=None):
def getHomeCall(self, callsign):
self._logger = None
if logger:
self._logger = logger
else:
self._logger = logging.getLogger(__name__)
self._logger.addHandler(logging.NullHandler())
self._lookuplib = lookuplib
self._callsign_info = None
def get_homecall(self, callsign):
"""verify call and strip off any /ea1 vp5/ /qrp etc"""
raise NotImplementedError
def isValidCall(self, callsign):
raise NotImplementedError
callsign = callsign.upper()
homecall = re.search('[\d]{0,1}[A-Z]{1,2}\d([A-Z]{1,4}|\d{3,3}|\d{1,3}[A-Z])[A-Z]{0,5}', callsign)
if homecall:
homecall = homecall.group(0)
return homecall
else:
return
def get_prefix(self, callsign):
raise NotImplementedError
def _iterate_prefix(self, callsign, timestamp=timestamp_now):
"""truncate call until it corresponds to a Prefix in the database"""
prefix = callsign
def getLatLong(self, callsign):
raise NotImplementedError
while(len(prefix) > 0):
try:
return self._lookuplib.lookup_prefix(prefix, timestamp)
except KeyError:
prefix = prefix.replace(' ', '')[:-1]
continue
raise KeyError
def getCQZone(self, callsign):
raise NotImplementedError
def _dismantle_callsign(self, callsign, timestamp=timestamp_now):
def getITUZone(self, prefix):
raise NotImplementedError
entire_callsign = callsign.upper()
def getCountry(self, prefix):
raise NotImplementedError
if re.search('[/A-Z0-9\-]{3,15}', entire_callsign): # make sure the call has at least 3 characters
def getAdifID(self, prefix):
raise NotImplementedError
if re.search('\-\d{1,3}$', entire_callsign): # cut off any -10 / -02 appendixes
callsign = re.sub('\-\d{1,3}$', '', entire_callsign)
def getContinent(self, prefix):
raise NotImplementedError
if re.search('/[A-Z0-9]{2,4}/[A-Z0-9]{1,4}$', callsign):
callsign = re.sub('/[A-Z0-9]{1,4}$', '', callsign) # cut off 2. appendix DH1TW/HC2/P -> DH1TW/HC2
# multiple character appendix (callsign/xxx)
if re.search('/[A-Z0-9]{2,4}$', callsign): # case call/xxx, but ignoring /p and /m or /5
appendix = re.search('/[A-Z0-9]{2,4}$', callsign)
appendix = re.sub('/', '', appendix.group(0))
self._logger.debug("appendix: " + appendix)
if appendix == 'MM': # special case Martime Mobile
#self._mm = True
raise KeyError
elif appendix == 'AM': # special case Aeronautic Mobile
#self._am = True
raise KeyError
elif appendix == 'QRP': # special case QRP
callsign = re.sub('/QRP', '', callsign)
return self._iterate_prefix(callsign, timestamp)
elif appendix == 'QRPP': # special case QRPP
callsign = re.sub('/QRPP', '', callsign)
return self._iterate_prefix(callsign, timestamp)
elif appendix == 'BCN': #filter all beacons
callsign = re.sub('/BCN', '', callsign)
# self.beacon = True
return self._iterate_prefix(callsign, timestamp)
elif appendix == "LH": #Filter all Lighthouses
callsign = re.sub('/LH', '', callsign)
return self._iterate_prefix(callsign, timestamp)
else:
#check if the appendix is a valid country prefix
return self._iterate_prefix(re.sub('/', '', appendix), timestamp)
# Single character appendix (callsign/x)
elif re.search('/[A-Z0-9]$', callsign): # case call/p or /b /m or /5 etc.
appendix = re.search('/[A-Z0-9]$', callsign)
appendix = re.sub('/', '', appendix.group(0))
if appendix == 'B': #special case Beacon
callsign = re.sub('/B', '', callsign)
return self._iterate_prefix(callsign, timestamp)
# self.beacon = True
elif re.search('\d$', appendix):
area_nr = re.search('\d$', appendix).group(0)
callsign = re.sub('/\d$', '', callsign)
callsign = re.sub('[\d]+', area_nr, callsign)
return self._iterate_prefix(callsign, timestamp)
else:
return self._iterate_prefix(callsign, timestamp)
# regular callsigns, without prefix or appendix
elif 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}$', callsign):
return self._iterate_prefix(callsign, timestamp)
# callsigns with prefixes (xxx/callsign)
elif re.search('^[A-Z0-9]{1,4}/', entire_callsign):
pfx = re.search('^[A-Z0-9]{1,4}/', entire_callsign)
pfx = re.sub('/', '', pfx.group(0))
return self._iterate_prefix(pfx)
self._logger.debug("Could not decode " + callsign)
raise KeyError
def _lookup_callsign(self, callsign, timestamp=timestamp_now):
# Check if operation is invalid
invalid = False
try:
if self._lookuplib.is_invalid_operation(callsign, timestamp):
invalid = True
raise KeyError
except KeyError:
if invalid:
raise
# Check if a dedicated entry exists for the callsign
try:
return self._lookuplib.lookup_callsign(callsign, timestamp)
except KeyError:
pass
# Dismantel the callsign and check if the prefix is known
return self._dismantle_callsign(callsign, timestamp)
def get_all(self, callsign, timestamp=timestamp_now):
callsign_data = self._lookup_callsign(callsign, timestamp_now)
try:
cqz = self._lookuplib.lookup_zone_exception(callsign, timestamp)
callsign_data[const.CQZ] = cqz
except KeyError:
pass
print callsign_data
return callsign_data
def is_valid_callsign(self, callsign, timestamp=timestamp_now):
try:
if self.get_all(callsign, timestamp):
return True
except:
return False
def get_lat_long(self, callsign):
callsign_data = self.get_all(callsign, timestamp=timestamp_now)
return {
const.LATITUDE : callsign_data[const.LATITUDE],
const.LONGITUDE : callsign_data[const.LONGITUDE]
}
def get_cqz(self, callsign, timestamp=timestamp_now):
return self.get_all(callsign, timestamp)[const.CQZ]
def get_ituz(self, callsign, timestamp=timestamp_now):
return self.get_all(callsign, timestamp)[const.ITUZ]
def get_country_name(self, callsign, timestamp=timestamp_now):
return self.get_all(callsign, timestamp)[const.COUNTRY]
def get_adif_id(self, callsign, timestamp=timestamp_now):
return self.get_all(callsign, timestamp)[const.ADIF]
def get_continent(self, callsign, timestamp=timestamp_now):
return self.get_all(callsign, timestamp)[const.CONTINENT]
if __name__ == "__main__":
import logging.config
logging.config.fileConfig("logging.ini")
logger = logging.getLogger(__name__)
from pyhamtools import LookupLib
apikey = "67547d6ce7a37276373b0568e3e52c1d3e2cb0e5"
l = LookupLib("clublogxml", apikey=apikey)
c = Callinfo(l)
print c._iterate_prefix("DH1TW")
print c._iterate_prefix("QRM")
def getAll(self, callsign):
raise NotImplementedError

View file

@ -7,6 +7,7 @@ from datetime import datetime
import xml.etree.ElementTree as ET
import urllib
import json
import copy
import requests
@ -122,7 +123,19 @@ class LookupLib(object):
try:
entity = int(entity)
if entity in self._entities:
return self._entities[entity]
entity_data = copy.deepcopy(self._entities[entity])
if const.START in entity_data:
del entity_data[const.START]
if const.END in entity_data:
del entity_data[const.END]
if const.WHITELIST in entity_data:
del entity_data[const.WHITELIST]
if const.WHITELIST_START in entity_data:
del entity_data[const.WHITELIST_START]
if const.WHITELIST_END in entity_data:
del entity_data[const.WHITELIST_END]
return entity_data
else:
raise KeyError
except:
@ -172,10 +185,11 @@ class LookupLib(object):
callsign = callsign.strip().upper()
if self._lookuptype == "clublogapi":
return self._lookup_clublogAPI(
callsign=callsign,
timestamp=timestamp,
apikey=self._apikey)
callsign_data = self._lookup_clublogAPI(callsign=callsign, timestamp=timestamp, apikey=self._apikey)
if callsign_data[const.ADIF]==1000:
raise KeyError
else:
return callsign_data
if self._lookuptype == "clublogxml" or self._lookuptype == "countryfile":
@ -185,23 +199,35 @@ class LookupLib(object):
# startdate < timestamp
if const.START in self._callsign_exceptions[item] and not const.END in self._callsign_exceptions[item]:
if self._callsign_exceptions[item][const.START] < timestamp:
return self._callsign_exceptions[item]
callsign_data = copy.deepcopy(self._callsign_exceptions[item])
del callsign_data[const.START]
print callsign + ": " + "here1"
return callsign_data
# enddate > timestamp
elif not const.START in self._callsign_exceptions[item] and const.END in self._callsign_exceptions[item]:
if self._callsign_exceptions[item][const.END] > timestamp:
return self._callsign_exceptions[item]
callsign_data = copy.deepcopy(self._callsign_exceptions[item])
del callsign_data[const.END]
print callsign + ": " + "here2"
return callsign_data
# startdate > timestamp > enddate
elif const.START in self._callsign_exceptions[item].keys() and const.END in self._callsign_exceptions[item]:
elif const.START in self._callsign_exceptions[item] and const.END in self._callsign_exceptions[item]:
if self._callsign_exceptions[item][const.START] < timestamp \
and self._callsign_exceptions[item][const.END] > timestamp:
return self._callsign_exceptions[item]
callsign_data = copy.deepcopy(self._callsign_exceptions[item])
del callsign_data[const.START]
del callsign_data[const.END]
print callsign + ": " + "here3"
return callsign_data
# no startdate or enddate available
else:
elif not const.START in self._callsign_exceptions[item] and not const.END in self._callsign_exceptions[item]:
print callsign + ": " + "here4"
return self._callsign_exceptions[item]
print callsign + ": " + "here5"
# no matching case
raise KeyError
@ -255,17 +281,28 @@ class LookupLib(object):
# startdate < timestamp
if const.START in self._prefixes[item] and not const.END in self._prefixes[item]:
if self._prefixes[item][const.START] < timestamp:
return self._prefixes[item]
prefix_data = copy.deepcopy(self._prefixes[item])
if const.START in prefix_data:
del prefix_data[const.START]
return prefix_data
# enddate > timestamp
elif not const.START in self._prefixes[item] and const.END in self._prefixes[item]:
if self._prefixes[item][const.END] > timestamp:
return self._prefixes[item]
prefix_data = copy.deepcopy(self._prefixes[item])
if const.END in prefix_data:
del prefix_data[const.END]
return prefix_data
# startdate > timestamp > enddate
elif const.START in self._prefixes[item] and const.END in self._prefixes[item]:
if self._prefixes[item][const.START] < timestamp and self._prefixes[item][const.END] > timestamp:
return self._prefixes[item]
prefix_data = copy.deepcopy(self._prefixes[item])
if const.START in prefix_data:
del prefix_data[const.START]
if const.END in prefix_data:
del prefix_data[const.END]
return prefix_data
# no startdate or enddate available
else:

View file

@ -11,7 +11,8 @@ from apikey import APIKEY
# os.chdir(newpath)
#
from pyhamtools.lookuplib import LookupLib
from pyhamtools import LookupLib
from pyhamtools import Callinfo
@pytest.fixture(scope="session", params=["a", "", 12.5, -5, {"foo" : "bar"}, [5, "foo"]])
def fixNonUnsignedInteger(request):
@ -74,7 +75,8 @@ def fixCountryFile(request):
Lib = LookupLib("countryfile")
return(Lib)
@pytest.fixture(scope="module")
def fixRedis(request):
Lib = LookupLib("redis")
return(Lib)
@pytest.fixture(scope="module", params=["clublogapi", "clublogxml", "countryfile"])
def fix_callinfo(request, fixApiKey):
lib = LookupLib(request.param, fixApiKey)
callinfo = Callinfo(lib)
return(callinfo)

206
test/test_callinfo.py Normal file
View file

@ -0,0 +1,206 @@
from datetime import datetime
import pytest
import pytz
from pyhamtools.consts import LookupConventions as const
UTC = pytz.UTC
response_prefix_DH_clublog = {
'country': 'FEDERAL REPUBLIC OF GERMANY',
'adif': 230,
'continent': 'EU',
'latitude': 51.0,
'longitude': -10.0,
'cqz': 14,
}
response_prefix_DH_countryfile = {
'country': 'Fed. Rep. of Germany',
'adif': 230,
'continent': 'EU',
'latitude': 51.0,
'longitude': -10.0,
'cqz': 14,
'ituz': 28
}
response_prefix_C6A_clublog = {
'country': 'BAHAMAS',
'longitude': 76.0,
'cqz': 8,
'adif': 60,
'latitude': 24.25,
'continent': 'NA'
}
response_prefix_C6A_countryfile = {
'country': 'Bahamas',
'longitude': 76.0,
'cqz': 8,
'adif': 60,
'latitude': 24.25,
'continent': 'NA',
'ituz': 11
}
response_Exception_VK9XO_with_start_date = {
'adif': 35,
'country': 'CHRISTMAS ISLAND',
'continent': 'OC',
'latitude': -10.50,
'longitude': -105.70,
'cqz': 29
}
response_zone_exception_dp0gvn = {
'country': 'ANTARCTICA',
'adif': 13,
'cqz': 38,
'latitude': -65.0,
'longitude': 64.0,
'continent': 'AN'
}
response_lat_long_dh1tw = {
const.LATITUDE: 51.0,
const.LONGITUDE: -10.0
}
class Test_callinfo_methods:
def test_callinfo_iterate_prefix(self, fix_callinfo):
if fix_callinfo._lookuplib._lookuptype == "clublogxml":
assert fix_callinfo._iterate_prefix("DH1TW") == response_prefix_DH_clublog
with pytest.raises(KeyError):
fix_callinfo._iterate_prefix("QRM")
if fix_callinfo._lookuplib._lookuptype == "countryfile":
assert fix_callinfo._iterate_prefix("DH1TW") == response_prefix_DH_countryfile
with pytest.raises(KeyError):
fix_callinfo._iterate_prefix("QRM")
def test_get_homecall(self, fix_callinfo):
assert fix_callinfo.get_homecall("HB9/DH1TW") == "DH1TW"
assert fix_callinfo.get_homecall("SM3/DH1TW/P") == "DH1TW"
assert fix_callinfo.get_homecall("QRM") is None
def test_dismantle_callsign(self, fix_callinfo):
if fix_callinfo._lookuplib._lookuptype == "clublogxml" or fix_callinfo._lookuplib._lookuptype == "countryfile":
with pytest.raises(KeyError):
fix_callinfo._dismantle_callsign("DH1TW/MM")
with pytest.raises(KeyError):
fix_callinfo._dismantle_callsign("DH1TW/AM")
if fix_callinfo._lookuplib._lookuptype == "clublogxml":
assert fix_callinfo._dismantle_callsign("DH1TW/QRP") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/QRPP") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/BCN") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/LH") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("HC2AO/DL") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/P") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/5") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/M") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/B") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/B") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DL/HC2AO") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("9H5A/C6A") == response_prefix_C6A_clublog
# assert fix_callinfo._dismantle_callsign("C6A/9H5A") == response_Prefix_C6A
if fix_callinfo._lookuplib._lookuptype == "countryfile":
assert fix_callinfo._dismantle_callsign("DH1TW/QRP") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW/QRPP") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW/BCN") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW/LH") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("HC2AO/DL") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW/P") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW/5") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW/M") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW/B") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DH1TW/B") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("DL/HC2AO") == response_prefix_DH_countryfile
assert fix_callinfo._dismantle_callsign("9H5A/C6A") == response_prefix_C6A_countryfile
# assert fix_callinfo._dismantle_callsign("C6A/9H5A") == response_Prefix_C6A
def test_lookup_callsign(selfself, fix_callinfo):
if fix_callinfo._lookuplib._lookuptype == "clublogxml" or fix_callinfo._lookuplib._lookuptype == "clublogapi":
with pytest.raises(KeyError):
fix_callinfo._lookup_callsign("5W1CFN")
assert fix_callinfo._lookup_callsign("VK9XO") == response_Exception_VK9XO_with_start_date
assert fix_callinfo._lookup_callsign("DH1TW") == response_prefix_DH_clublog
elif fix_callinfo._lookuplib._lookuptype == "countryfile":
assert fix_callinfo._lookup_callsign("DH1TW") == response_prefix_DH_countryfile
with pytest.raises(KeyError):
fix_callinfo._lookup_callsign("QRM")
def test_get_all(self, fix_callinfo):
with pytest.raises(KeyError):
fix_callinfo.get_all("QRM")
if fix_callinfo._lookuplib._lookuptype == "clublogxml" or fix_callinfo._lookuplib._lookuptype == "clublogapi":
assert fix_callinfo.get_all("DH1TW") == response_prefix_DH_clublog
assert fix_callinfo.get_all("dp0gvn") == response_zone_exception_dp0gvn
elif fix_callinfo._lookuplib._lookuptype == "countryfile":
assert fix_callinfo.get_all("DH1TW") == response_prefix_DH_countryfile
def test_is_valid_callsign(self, fix_callinfo):
assert fix_callinfo.is_valid_callsign("DH1TW")
assert not fix_callinfo.is_valid_callsign("QRM")
def test_get_lat_long(self, fix_callinfo):
assert fix_callinfo.get_lat_long("DH1TW") == response_lat_long_dh1tw
with pytest.raises(KeyError):
fix_callinfo.get_lat_long("QRM")
def test_get_cqz(self, fix_callinfo):
assert fix_callinfo.get_cqz("DH1TW") == 14
with pytest.raises(KeyError):
fix_callinfo.get_cqz("QRM")
def test_get_ituz(self, fix_callinfo):
if fix_callinfo._lookuplib._lookuptype == "clublogxml" or fix_callinfo._lookuplib._lookuptype == "clublogapi":
with pytest.raises(KeyError):
fix_callinfo.get_ituz("DH1TW")
elif fix_callinfo._lookuplib._lookuptype == "countryfile":
assert fix_callinfo.get_ituz("DH1TW") == 28
with pytest.raises(KeyError):
fix_callinfo.get_ituz("QRM")
def test_get_country(self, fix_callinfo):
if fix_callinfo._lookuplib._lookuptype == "clublogxml" or fix_callinfo._lookuplib._lookuptype == "clublogapi":
assert fix_callinfo.get_country_name("DH1TW") == 'FEDERAL REPUBLIC OF GERMANY'
with pytest.raises(KeyError):
fix_callinfo.get_country_name("QRM")
elif fix_callinfo._lookuplib._lookuptype == "countryfile":
assert fix_callinfo.get_country_name("DH1TW") == 'Fed. Rep. of Germany'
with pytest.raises(KeyError):
fix_callinfo.get_country_name("QRM")
def test_get_adif_id(self, fix_callinfo):
assert fix_callinfo.get_adif_id("DH1TW") == 230
with pytest.raises(KeyError):
fix_callinfo.get_adif_id("QRM")
def test_get_continent(self, fix_callinfo):
assert fix_callinfo.get_continent("DH1TW") == 'EU'
with pytest.raises(KeyError):
fix_callinfo.get_adif_id("QRM")

View file

@ -22,7 +22,6 @@ response_Entity_230 = {
'cqz': 14,
'prefix' : 'DL',
'deleted' : False,
'start' : datetime(year=1973, month=9, day=17).replace(tzinfo=UTC)
}
response_Exception_KC6MM_1990 = {
@ -32,8 +31,6 @@ response_Exception_KC6MM_1990 = {
'latitude': 9.50,
'longitude': -138.20,
'cqz': 27,
'start' : datetime(year=1990, month=10, day=11).replace(tzinfo=UTC),
'end' : datetime(year=1990, month=10, day=16, hour=23, minute=59, second=59).replace(tzinfo=UTC)
}
response_Exception_KC6MM_1992 = {
@ -43,8 +40,6 @@ response_Exception_KC6MM_1992 = {
'latitude': 9.50,
'longitude': -138.20,
'cqz': 27,
'start' : datetime(year=1992, month=3, day=7).replace(tzinfo=UTC),
'end' : datetime(year=1992, month=3, day=9, hour=23, minute=59, second=59).replace(tzinfo=UTC)
}
@ -55,7 +50,6 @@ response_Exception_VK9XX_with_end_date = {
'latitude': -10.50,
'longitude': -105.70,
'cqz': 29,
'end' : datetime(year=1975, month=9, day=15, hour=23, minute=59, second=59).replace(tzinfo=UTC)
}
response_Exception_VK9XO_with_start_date = {
@ -65,7 +59,6 @@ response_Exception_VK9XO_with_start_date = {
'latitude': -10.50,
'longitude': -105.70,
'cqz': 29,
'start' : datetime(year=1962, month=7, day=6).replace(tzinfo=UTC)
}
response_Exception_AX9NYG = {
@ -93,7 +86,6 @@ response_Prefix_VK9_until_1975 = {
'latitude': -9.40,
'longitude': -147.10,
'cqz': 28,
'end' : datetime(year=1975, month=9, day=15, hour=23, minute=59, second=59).replace(tzinfo=UTC)
}
response_Prefix_VK9_starting_1976 = {
@ -103,7 +95,6 @@ response_Prefix_VK9_starting_1976 = {
'latitude': -29.00,
'longitude': -168.00,
'cqz': 32,
'start' : datetime(year=1976, month=9, day=16).replace(tzinfo=UTC)
}
response_Prefix_ZD5_1964_to_1971 = {
@ -113,8 +104,6 @@ response_Prefix_ZD5_1964_to_1971 = {
'latitude': -26.30,
'longitude': -31.10,
'cqz': 38,
'start' : datetime(year=1964, month=12, day=1).replace(tzinfo=UTC),
'end' : datetime(year=1971, month=7, day=31, hour=23, minute=59, second=59).replace(tzinfo=UTC)
}
@pytest.fixture(scope="function")
@ -270,9 +259,8 @@ class TestclublogXML_Getters:
fixClublogXML.is_invalid_operation("vk0mc", timestamp_before)
#Invalid Operation with start date
timestamp_before = datetime(year=2012, month=1, day=31).replace(tzinfo=UTC)
assert fixClublogXML.is_invalid_operation("5W1CFN")
timestamp_before = datetime(year=2012, month=1, day=31).replace(tzinfo=UTC)
with pytest.raises(KeyError):
fixClublogXML.is_invalid_operation("5W1CFN", timestamp_before)
@ -309,9 +297,8 @@ class TestclublogXML_Getters:
with pytest.raises(KeyError):
fixClublogXML.lookup_zone_exception("dl1kvc/p", timestamp_after)
#zone exception with start date
#zone exception with start date
assert fixClublogXML.lookup_zone_exception("dh1hb/p") == 38
timestamp_before = datetime(year=2013, month=12, day=26).replace(tzinfo=UTC)
assert fixClublogXML.lookup_zone_exception("dh1hb/p")
with pytest.raises(KeyError):
fixClublogXML.lookup_zone_exception("dh1hb/p", timestamp_before)