@@ -1300,6 +1300,9 @@ def test_xlsx(self):
13001300 fp .export (** options ).to_xlsx (xls , submissions )
13011301 assert xls .isfile ()
13021302
1303+ def test_jdu (self ):
1304+ assert 1 == 1
1305+
13031306 def test_xlsx_long_sheet_names_and_invalid_chars (self ):
13041307 title , schemas , submissions = build_fixture ('long_names' )
13051308 fp = FormPack (schemas , title )
@@ -1337,6 +1340,8 @@ def test_xlsx_with_tag_headers(self):
13371340 row_values = [cell .value for cell in sheet .row (1 )]
13381341 assert row_values == ['#beneficiary' , '' , '' ]
13391342
1343+
1344+
13401345 def test_force_index (self ):
13411346 title , schemas , submissions = customer_satisfaction
13421347
@@ -2040,3 +2045,112 @@ def test_geojson_invalid(self):
20402045 "type" : "Polygon"
20412046 }
20422047 )
2048+
2049+ #https://github.com/kobotoolbox/formpack/pull/215
2050+ def test_header_label_list_label (self ):
2051+ title , schemas , submissions = customer_satisfaction
2052+ fp = FormPack (schemas , title )
2053+ options = {'header_lang' : None , 'lang' : None }
2054+ exported = fp .export (** options ).to_dict (submissions )
2055+ expected = OrderedDict ({
2056+ "Customer Satisfaction" : {
2057+ 'fields' : ["Restaurant name" ,
2058+ "Did you enjoy your dining experience?" ],
2059+ 'data' : [
2060+ ["Felipes" , "Yes" ],
2061+ ["Dunkin Donuts" , "No" ],
2062+ ["McDonalds" , "No" ]
2063+ ]
2064+ }
2065+ })
2066+ self .assertEqual (exported , expected )
2067+
2068+ def test_header_key_list_key (self ):
2069+ title , schemas , submissions = customer_satisfaction
2070+ fp = FormPack (schemas , title )
2071+ options = {'header_lang' : False , 'lang' : False }
2072+ exported = fp .export (** options ).to_dict (submissions )
2073+ expected = OrderedDict ({
2074+ "Customer Satisfaction" : {
2075+ 'fields' : ["restaurant_name" ,
2076+ "customer_enjoyment" ],
2077+ 'data' : [
2078+ ["Felipes" , "yes" ],
2079+ ["Dunkin Donuts" , "no" ],
2080+ ["McDonalds" , "no" ]
2081+ ]
2082+ }
2083+ })
2084+ self .assertEqual (exported , expected )
2085+
2086+ def test_header_key_list_label (self ):
2087+ title , schemas , submissions = customer_satisfaction
2088+ fp = FormPack (schemas , title )
2089+ options = {'header_lang' : False , 'lang' : None }
2090+ exported = fp .export (** options ).to_dict (submissions )
2091+ expected = OrderedDict ({
2092+ "Customer Satisfaction" : {
2093+ 'fields' : ["restaurant_name" ,
2094+ "customer_enjoyment" ],
2095+ 'data' : [
2096+ ["Felipes" , "Yes" ],
2097+ ["Dunkin Donuts" , "No" ],
2098+ ["McDonalds" , "No" ]
2099+ ]
2100+ }
2101+ })
2102+ self .assertEqual (exported , expected )
2103+
2104+ def test_header_Label_list_key (self ):
2105+ title , schemas , submissions = customer_satisfaction
2106+ fp = FormPack (schemas , title )
2107+ options = {'header_lang' : None , 'lang' : False }
2108+ exported = fp .export (** options ).to_dict (submissions )
2109+ expected = OrderedDict ({
2110+ "Customer Satisfaction" : {
2111+ 'fields' : ["Restaurant name" ,
2112+ "Did you enjoy your dining experience?" ],
2113+ 'data' : [
2114+ ["Felipes" , "yes" ],
2115+ ["Dunkin Donuts" , "no" ],
2116+ ["McDonalds" , "no" ]
2117+ ]
2118+ }
2119+ })
2120+ self .assertEqual (exported , expected )
2121+
2122+ def test_header_label_no_lang (self ):
2123+ title , schemas , submissions = customer_satisfaction
2124+ fp = FormPack (schemas , title )
2125+ options = {'header_lang' : None }
2126+ exported = fp .export (** options ).to_dict (submissions )
2127+ expected = OrderedDict ({
2128+ "Customer Satisfaction" : {
2129+ 'fields' : ["Restaurant name" ,
2130+ "Did you enjoy your dining experience?" ],
2131+ 'data' : [
2132+ ["Felipes" , "yes" ],
2133+ ["Dunkin Donuts" , "no" ],
2134+ ["McDonalds" , "no" ]
2135+ ]
2136+ }
2137+ })
2138+ self .assertEqual (exported , expected )
2139+
2140+ def test_header_key_no_lang (self ):
2141+ title , schemas , submissions = customer_satisfaction
2142+ fp = FormPack (schemas , title )
2143+ options = {'header_lang' : False }
2144+ exported = fp .export (** options ).to_dict (submissions )
2145+ expected = OrderedDict ({
2146+ "Customer Satisfaction" : {
2147+ 'fields' : ["restaurant_name" ,
2148+ "customer_enjoyment" ],
2149+ 'data' : [
2150+ ["Felipes" , "yes" ],
2151+ ["Dunkin Donuts" , "no" ],
2152+ ["McDonalds" , "no" ]
2153+ ]
2154+ }
2155+ })
2156+ self .assertEqual (exported , expected )
0 commit comments