コード例 #1
0
 def _assert_address_level(self, dict_ret, dict_exp, distance_eps=100):
     self.assertEqual(dict_ret["name"], dict_exp["name"])
     self.assertEqual(dict_ret["level"], dict_exp["level"])
     geo_point_ret = [dict_ret["y"], dict_ret["x"]]
     geo_point_exp = [dict_exp["y"], dict_exp["x"]]
     dist_ret_and_exp = distance_hubeny(geo_point_ret, geo_point_exp)
     self.assertAlmostEqual(0.0, dist_ret_and_exp, delta=distance_eps)
コード例 #2
0
 def test_distance_hubeny_long(self):
     geo_point_x = [35.65500, 139.74472]
     geo_point_y = [36.10056, 140.09111]
     returned = distance_hubeny(geo_point_x, geo_point_y)
     expected = 58501.873
     self.assertAlmostEqual(returned, expected, delta=expected * 0.001)
コード例 #3
0
 def test_distance_hubeny_short(self):
     geo_point_x = [35.802739, 140.380034]
     geo_point_y = [35.785796, 140.392265]
     returned = distance_hubeny(geo_point_x, geo_point_y)
     expected = 2180
     self.assertAlmostEqual(returned, expected, delta=expected * 0.001)