当前位置: 首页>>代码示例>>Python>>正文


Python ExportBuilder.split_select_multiples方法代码示例

本文整理汇总了Python中onadata.libs.utils.export_tools.ExportBuilder.split_select_multiples方法的典型用法代码示例。如果您正苦于以下问题:Python ExportBuilder.split_select_multiples方法的具体用法?Python ExportBuilder.split_select_multiples怎么用?Python ExportBuilder.split_select_multiples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在onadata.libs.utils.export_tools.ExportBuilder的用法示例。


在下文中一共展示了ExportBuilder.split_select_multiples方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_split_select_multiples_works

# 需要导入模块: from onadata.libs.utils.export_tools import ExportBuilder [as 别名]
# 或者: from onadata.libs.utils.export_tools.ExportBuilder import split_select_multiples [as 别名]
 def test_split_select_multiples_works(self):
     select_multiples = {
         "children/fav_colors": ["children/fav_colors/red", "children/fav_colors/blue", "children/fav_colors/pink"]
     }
     row = {"children/name": "Mike", "children/age": 5, "children/fav_colors": "red blue"}
     new_row = ExportBuilder.split_select_multiples(row, select_multiples)
     expected_row = {
         "children/name": "Mike",
         "children/age": 5,
         "children/fav_colors": "red blue",
         "children/fav_colors/red": True,
         "children/fav_colors/blue": True,
         "children/fav_colors/pink": False,
     }
     self.assertEqual(new_row, expected_row)
     row = {"children/name": "Mike", "children/age": 5}
     new_row = ExportBuilder.split_select_multiples(row, select_multiples)
     expected_row = {
         "children/name": "Mike",
         "children/age": 5,
         "children/fav_colors/red": None,
         "children/fav_colors/blue": None,
         "children/fav_colors/pink": None,
     }
     self.assertEqual(new_row, expected_row)
开发者ID:CharaD7,项目名称:kobocat,代码行数:27,代码来源:test_export_builder.py

示例2: test_split_select_multiples_works_when_data_is_blank

# 需要导入模块: from onadata.libs.utils.export_tools import ExportBuilder [as 别名]
# 或者: from onadata.libs.utils.export_tools.ExportBuilder import split_select_multiples [as 别名]
 def test_split_select_multiples_works_when_data_is_blank(self):
     select_multiples =\
         {
             'children/fav_colors': [
                 'children/fav_colors/red', 'children/fav_colors/blue',
                 'children/fav_colors/pink']
         }
     row = \
         {
             'children/name': 'Mike',
             'children/age': 5,
             'children/fav_colors': ''
         }
     new_row = ExportBuilder.split_select_multiples(
         row, select_multiples)
     expected_row = \
         {
             'children/name': 'Mike',
             'children/age': 5,
             'children/fav_colors': '',
             'children/fav_colors/red': None,
             'children/fav_colors/blue': None,
             'children/fav_colors/pink': None
         }
     self.assertEqual(new_row, expected_row)
开发者ID:199212151746,项目名称:onadata,代码行数:27,代码来源:test_export_builder.py

示例3: test_split_select_multiples_works

# 需要导入模块: from onadata.libs.utils.export_tools import ExportBuilder [as 别名]
# 或者: from onadata.libs.utils.export_tools.ExportBuilder import split_select_multiples [as 别名]
 def test_split_select_multiples_works(self):
     select_multiples =\
         {
             'children/fav_colors': [
                 'children/fav_colors/red', 'children/fav_colors/blue',
                 'children/fav_colors/pink']
         }
     row = \
         {
             'children/name': 'Mike',
             'children/age': 5,
             'children/fav_colors': 'red blue'
         }
     new_row = ExportBuilder.split_select_multiples(
         row, select_multiples)
     expected_row = \
         {
             'children/name': 'Mike',
             'children/age': 5,
             'children/fav_colors': 'red blue',
             'children/fav_colors/red': True,
             'children/fav_colors/blue': True,
             'children/fav_colors/pink': False
         }
     self.assertEqual(new_row, expected_row)
     row = \
         {
             'children/name': 'Mike',
             'children/age': 5,
         }
     new_row = ExportBuilder.split_select_multiples(
         row, select_multiples)
     expected_row = \
         {
             'children/name': 'Mike',
             'children/age': 5,
             'children/fav_colors/red': None,
             'children/fav_colors/blue': None,
             'children/fav_colors/pink': None
         }
     self.assertEqual(new_row, expected_row)
开发者ID:199212151746,项目名称:onadata,代码行数:43,代码来源:test_export_builder.py

示例4: test_split_select_multiples_works_when_data_is_blank

# 需要导入模块: from onadata.libs.utils.export_tools import ExportBuilder [as 别名]
# 或者: from onadata.libs.utils.export_tools.ExportBuilder import split_select_multiples [as 别名]
 def test_split_select_multiples_works_when_data_is_blank(self):
     select_multiples = {
         "children/fav_colors": ["children/fav_colors/red", "children/fav_colors/blue", "children/fav_colors/pink"]
     }
     row = {"children/name": "Mike", "children/age": 5, "children/fav_colors": ""}
     new_row = ExportBuilder.split_select_multiples(row, select_multiples)
     expected_row = {
         "children/name": "Mike",
         "children/age": 5,
         "children/fav_colors": "",
         "children/fav_colors/red": None,
         "children/fav_colors/blue": None,
         "children/fav_colors/pink": None,
     }
     self.assertEqual(new_row, expected_row)
开发者ID:CharaD7,项目名称:kobocat,代码行数:17,代码来源:test_export_builder.py


注:本文中的onadata.libs.utils.export_tools.ExportBuilder.split_select_multiples方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。