Fix bug in latitude/longitude conversion
Fixed unit test for python3. int('+ 1') works in python2 but not python3. Also corrected a unit test.
This commit is contained in:
parent
fb30873888
commit
dce7a6d7f7
@ -116,9 +116,12 @@ def __convert_using_colon_repr(stringValue):
|
|||||||
# if no characters before ':' nothing useful is input!
|
# if no characters before ':' nothing useful is input!
|
||||||
if len(l[0]) == 0:
|
if len(l[0]) == 0:
|
||||||
return None
|
return None
|
||||||
if l[0][0] == '-':
|
if l[0][0] in ['+', '-']:
|
||||||
sign = '-'
|
sign = l[0][0]
|
||||||
l[0]=l[0][1:]
|
l[0]=l[0][1:].strip()
|
||||||
|
# regard a second sign as an error
|
||||||
|
if l[0][0] in ['+', '-']:
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
sign = '+'
|
sign = '+'
|
||||||
try:
|
try:
|
||||||
|
@ -202,7 +202,7 @@ class PlaceTest(unittest.TestCase):
|
|||||||
self._test_formats_fail(lat, lon)
|
self._test_formats_fail(lat, lon)
|
||||||
|
|
||||||
lat, lon = '-50:10:1', '-+2:1:2'
|
lat, lon = '-50:10:1', '-+2:1:2'
|
||||||
self._test_formats_success(lat, lon)
|
self._test_formats_fail(lat, lon)
|
||||||
|
|
||||||
def test_missing_minute(self):
|
def test_missing_minute(self):
|
||||||
lat, lon = '-50::1', '-2:1:2'
|
lat, lon = '-50::1', '-2:1:2'
|
||||||
|
Loading…
Reference in New Issue
Block a user