zebpalmer/WeatherAlerts — pull request #7 by csabatini (2014-10-22 20:18:37+00:00)
Title: fix NWS samecode url

I was getting started with this project and noticed that the unit tests for geo.py and weatheralerts.py were failing.

======================================================================
ERROR: test_samecode_lookup_false (__main__.Test_GeoDB)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_geodb.py", line 9, in setUp
self.geo = GeoDB()
File "weatheralerts\geo.py", line
16, in __init__
self.__same = SameCodes()
File "weatheralerts\geo.py", line
93, in __init__
self._load_same_codes()
File "weatheralerts\geo.py", line
109, in _load_same_codes
self._cached_same_codes()
File "weatheralerts\geo.py", line
149, in _cached_same_codes
self.reload()
File "weatheralerts\geo.py", line
102, in reload
self._load_same_codes(refresh=True)
File "weatheralerts\geo.py", line
107, in _load_same_codes
self._get_same_codes()
File "weatheralerts\geo.py", line
119, in _get_same_codes
code, local, state = str(row).strip().split(',')
ValueError: need more than 1 value to unpack

----------------------------------------------------------------------
Ran 8 tests in 0.512s

FAILED (errors=8)

It seems the HTTP call made in _get_same_codes() is to a dead url, found the new location here: http://www.nws.noaa.gov/nwr/data/SameCode.txt. All tests passing again after this fix.