Example #1
0
 def test_init_degrees_minutes_seconds(self):
     c = Coords(
         "35|33|32|S|138|52|48|E|region:AU-SA_type:river_source:dewiki|display=title"
     )
     self.assertAlmostEqual(-35.55533333, c.lat, places=5)
     self.assertAlmostEqual(138.8746666666, c.long, places=5)
Example #2
0
 def test_init_unexpected_format1(self):
     c = Coords("60|-134|type:landmark_region:CA-BC|display=title")
     self.assertAlmostEqual(60, c.lat, places=5)
     self.assertAlmostEqual(-134, c.long, places=5)
Example #3
0
 def test_init_degrees_minutes_unexpected_space(self):
     c = Coords("48|37|S|68|44|E |type:isle_region:FR-TF |name=")
     self.assertAlmostEqual(-48.616666, c.lat, places=4)
     self.assertAlmostEqual(68.733333, c.long, places=4)
Example #4
0
 def test_init_degrees_minutes_utf_8_char(self):
     c = Coords(
         "48|37|S|68|44|E |type:isle_region:FR-TF |name=Îles Nuageuses")
     self.assertAlmostEqual(-48.616666, c.lat, places=4)
     self.assertAlmostEqual(68.733333, c.long, places=4)
Example #5
0
 def test_init_unexpected_format8(self):
     c = Coords(" 59 | 10 |N| 5 | 10 |E|display=title")
     self.assertAlmostEqual(59.1666666, c.lat, places=5)
     self.assertAlmostEqual(5.1666666, c.long, places=5)
Example #6
0
 def test_init_degrees_minutes_negative_latitude(self):
     c = Coords("49|21|S|70|16|E|region:FR-TF_type:landmark |name=FUSOV")
     self.assertAlmostEqual(-49.349999, c.lat, places=4)
     self.assertAlmostEqual(70.266666, c.long, places=4)
Example #7
0
 def test_init_negative_latitude(self):
     c = Coords(
         "-84.87083|45.85833|region:US-MI_type:isle|name=St. Helena Island")
     self.assertAlmostEqual(45.85833, c.long, places=4)
     self.assertAlmostEqual(-84.87083, c.lat, places=4)
Example #8
0
 def test_init_unexpected_format4(self):
     c = Coords("31|35|type:country|display=title")
     self.assertAlmostEqual(31, c.lat, places=5)
     self.assertAlmostEqual(35, c.long, places=5)
Example #9
0
 def test_init_unexpected_format11(self):
     c = Coords(
         "41|53|37|N|12|29|E|source:dewiki_type:landmark_dim:20_region:IT-RM|display=title"
     )
     self.assertAlmostEqual(41.889499647, c.lat, places=5)
     self.assertAlmostEqual(12.4833333, c.long, places=5)
Example #10
0
 def test_init_floats_with_compass_points(self):
     c = Coords("2.35|N|99.1|E|")
     self.assertAlmostEqual(2.350000, c.lat, places=4)
     self.assertAlmostEqual(99.100000, c.long, places=4)
Example #11
0
 def test_init_unexpected_format10(self):
     c = Coords("0|+93.5|display=inline,title")
     self.assertAlmostEqual(0, c.lat, places=5)
     self.assertAlmostEqual(93.5, c.long, places=5)
Example #12
0
 def test_init_unexpected_format9(self):
     c = Coords("-90|0|region:AQ_scale:10000000|display=title")
     self.assertAlmostEqual(-90, c.lat, places=5)
     self.assertAlmostEqual(0, c.long, places=5)
Example #13
0
 def test_init_floats_minimal(self):
     c = Coords("39.617998|22.404998")
     self.assertAlmostEqual(39.617998, c.lat, places=4)
     self.assertAlmostEqual(22.404998, c.long, places=4)
Example #14
0
 def test_init_unexpected_format2(self):
     c = Coords("51|3.3|display=title")
     self.assertAlmostEqual(51, c.lat, places=5)
     self.assertAlmostEqual(3.3, c.long, places=5)
Example #15
0
 def test_degrees_minutes_ints_minimal(self):
     c = Coords(
         "66|34|N|023|51|E|type:country_region:FI|name=04 Lapland Province, Finland"
     )
     self.assertAlmostEqual(66.566666666, c.lat, places=4)
     self.assertAlmostEqual(23.85, c.long, places=4)
Example #16
0
 def test_init_unexpected_format3(self):
     c = Coords("46|0|0|53|0|0||display=inline,title")
     self.assertAlmostEqual(46, c.lat, places=5)
     self.assertAlmostEqual(53, c.long, places=5)
Example #17
0
 def test_init_degrees_minutes_negative_longitude(self):
     c = Coords("33|0|N|86|40|W|type:adm2nd_dim:1000000|display=title")
     self.assertAlmostEqual(33.0, c.lat)
     self.assertAlmostEqual(-86.6666666666, c.long, places=4)
Example #18
0
 def test_init_unexpected_format5(self):
     c = Coords(
         "13 |40 |00 |N|102 |60 |60 |E|region:KH_type:city|display=inline")
     self.assertAlmostEqual(13.666666666, c.lat, places=5)
     self.assertAlmostEqual(103.01000000, c.long, places=5)
Example #19
0
 def test_init_unexpected_format7(self):
     c = Coords(
         "name=South Wellington No. 10|49.088722|N|123.893037|W|region:CA_type:landmark|display=inline"
     )
     self.assertAlmostEqual(49.088722, c.lat, places=5)
     self.assertAlmostEqual(-123.893037, c.long, places=5)