本文整理汇总了Python中onadata.libs.utils.export_tools.ExportBuilder.split_gps_components方法的典型用法代码示例。如果您正苦于以下问题:Python ExportBuilder.split_gps_components方法的具体用法?Python ExportBuilder.split_gps_components怎么用?Python ExportBuilder.split_gps_components使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类onadata.libs.utils.export_tools.ExportBuilder
的用法示例。
在下文中一共展示了ExportBuilder.split_gps_components方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_split_gps_components_works_when_gps_data_is_blank
# 需要导入模块: from onadata.libs.utils.export_tools import ExportBuilder [as 别名]
# 或者: from onadata.libs.utils.export_tools.ExportBuilder import split_gps_components [as 别名]
def test_split_gps_components_works_when_gps_data_is_blank(self):
gps_fields = {
"geo/geolocation": [
"geo/_geolocation_latitude",
"geo/_geolocation_longitude",
"geo/_geolocation_altitude",
"geo/_geolocation_precision",
]
}
row = {"geo/geolocation": ""}
new_row = ExportBuilder.split_gps_components(row, gps_fields)
expected_row = {"geo/geolocation": ""}
self.assertEqual(new_row, expected_row)
示例2: test_split_gps_components_works
# 需要导入模块: from onadata.libs.utils.export_tools import ExportBuilder [as 别名]
# 或者: from onadata.libs.utils.export_tools.ExportBuilder import split_gps_components [as 别名]
def test_split_gps_components_works(self):
gps_fields = {
"geo/geolocation": [
"geo/_geolocation_latitude",
"geo/_geolocation_longitude",
"geo/_geolocation_altitude",
"geo/_geolocation_precision",
]
}
row = {"geo/geolocation": "1.0 36.1 2000 20"}
new_row = ExportBuilder.split_gps_components(row, gps_fields)
expected_row = {
"geo/geolocation": "1.0 36.1 2000 20",
"geo/_geolocation_latitude": "1.0",
"geo/_geolocation_longitude": "36.1",
"geo/_geolocation_altitude": "2000",
"geo/_geolocation_precision": "20",
}
self.assertEqual(new_row, expected_row)
示例3: test_split_gps_components_works_when_gps_data_is_blank
# 需要导入模块: from onadata.libs.utils.export_tools import ExportBuilder [as 别名]
# 或者: from onadata.libs.utils.export_tools.ExportBuilder import split_gps_components [as 别名]
def test_split_gps_components_works_when_gps_data_is_blank(self):
gps_fields =\
{
'geo/geolocation':
[
'geo/_geolocation_latitude', 'geo/_geolocation_longitude',
'geo/_geolocation_altitude', 'geo/_geolocation_precision'
]
}
row = \
{
'geo/geolocation': '',
}
new_row = ExportBuilder.split_gps_components(
row, gps_fields)
expected_row = \
{
'geo/geolocation': '',
}
self.assertEqual(new_row, expected_row)
示例4: test_split_gps_components_works
# 需要导入模块: from onadata.libs.utils.export_tools import ExportBuilder [as 别名]
# 或者: from onadata.libs.utils.export_tools.ExportBuilder import split_gps_components [as 别名]
def test_split_gps_components_works(self):
gps_fields =\
{
'geo/geolocation':
[
'geo/_geolocation_latitude', 'geo/_geolocation_longitude',
'geo/_geolocation_altitude', 'geo/_geolocation_precision'
]
}
row = \
{
'geo/geolocation': '1.0 36.1 2000 20',
}
new_row = ExportBuilder.split_gps_components(
row, gps_fields)
expected_row = \
{
'geo/geolocation': '1.0 36.1 2000 20',
'geo/_geolocation_latitude': '1.0',
'geo/_geolocation_longitude': '36.1',
'geo/_geolocation_altitude': '2000',
'geo/_geolocation_precision': '20'
}
self.assertEqual(new_row, expected_row)