Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)