本文整理汇总了Python中location.Location.getCoordinates方法的典型用法代码示例。如果您正苦于以下问题:Python Location.getCoordinates方法的具体用法?Python Location.getCoordinates怎么用?Python Location.getCoordinates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类location.Location
的用法示例。
在下文中一共展示了Location.getCoordinates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testMumbai
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import getCoordinates [as 别名]
def testMumbai(self):
lc = Location()
mumbai_cord = lc.getCoordinates(query="Mumbai")
mumbai_expected = Coordinates(lat=19.017587, lng=72.856248, state="Maharashtra", sub_district="Mumbai",
district="Mumbai", level="Town", name="MUMBAI")
self.assertTrue((float(mumbai_cord.lat) - float(mumbai_expected.lat)) < 0.00001, "Latitude didnot Match for Mumbai")
self.assertTrue((float(mumbai_cord.lng) - float(mumbai_expected.lng))< 0.00001, "Longitude didnot Match for Mumbai")
self.assertEqual(mumbai_cord.state, mumbai_expected.state, "States didnot Match for Mumbai")
self.assertEqual(mumbai_cord.district, mumbai_expected.district, "District didnot Match for Mumbai")
self.assertEqual(mumbai_cord.sub_district, mumbai_expected.sub_district, "SUB District didnot Match for Mumbai")
self.assertEqual(mumbai_cord.level, mumbai_expected.level, "Levels didnot Match for Mumbai")
示例2: testNehdaiJaisalmerRajasthan
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import getCoordinates [as 别名]
def testNehdaiJaisalmerRajasthan(self):
lc = Location(state="Rajasthan", district="Jaisalmer")
nehdai_cord = lc.getCoordinates(query="Nehdai")
nehdai_expected = Coordinates(lat=27.402876,lng=70.995243, state="Rajasthan", district="Jaisalmer",
sub_district="Jaisalmer", level="Village", name="NEHDAI")
self.assertEqual(nehdai_cord,nehdai_expected,"Cordinates didnot Match for Nehdai, (JSM) Rajasthan")