예제 #1
0
 def test_valid_latlons(self):
     locations = "0,0|-90,-180|90,180|0.1,0.1"
     lats, lons = api._parse_locations(locations, MAX_N_POINTS)
     assert lats == [0, -90, 90, 0.1]
     assert lons == [0, -180, 180, 0.1]
예제 #2
0
 def test_too_many_latlon_locations(self):
     with pytest.raises(api.ClientError):
         api._parse_locations("10,10|5,5", 1)
예제 #3
0
 def test_small_lat(self):
     with pytest.raises(api.ClientError):
         api._parse_locations("-91,0", MAX_N_POINTS)
예제 #4
0
 def test_large_lon(self):
     with pytest.raises(api.ClientError):
         api._parse_locations("0, 181", MAX_N_POINTS)
예제 #5
0
 def test_invalid_polyline(self):
     with pytest.raises(api.ClientError):
         api._parse_locations("$$$", MAX_N_POINTS)
예제 #6
0
 def test_lat_lon_wrong_order(self):
     with pytest.raises(api.ClientError):
         api._parse_locations("180,90", MAX_N_POINTS)
예제 #7
0
 def test_invalid_lon(self):
     with pytest.raises(api.ClientError):
         api._parse_locations("0,0|0,Test", MAX_N_POINTS)
예제 #8
0
 def test_empty_input(self):
     with pytest.raises(api.ClientError):
         api._parse_locations("", MAX_N_POINTS)
예제 #9
0
 def test_strip_enc_prefix(self):
     p1 = "enc:gfo}EtohhUxD@bAxJmGF"
     p2 = "gfo}EtohhUxD@bAxJmGF"
     assert api._parse_locations(p1, MAX_N_POINTS) == api._parse_locations(
         p2, MAX_N_POINTS)
예제 #10
0
 def test_too_many_polyline_locations(self):
     with pytest.raises(api.ClientError):
         api._parse_locations("kzn_JmmvhAjdIelA", 1)
예제 #11
0
 def test_valid_polyline(self):
     locations = "tpmjFukpm`@hvwMh|i@rlZefC"
     lats, lons = api._parse_locations(locations, MAX_N_POINTS)
     assert lats == [-38.57691, -40.99728, -41.13770]
     assert lons == [175.39787, 175.17814, 175.19977]