Skip to content

Commit 758a002

Browse files
committed
Added a unittest
1 parent a4e4240 commit 758a002

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

tests/test_exports.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ def test_export_with_choice_lists(self):
191191
'',
192192
'traditionnel']])
193193

194-
195194
def test_headers_of_group_exports(self):
196195
title, schemas, submissions = build_fixture('grouped_questions')
197196
fp = FormPack(schemas, title)
@@ -1746,3 +1745,34 @@ def test_untranslated_spss_labels(self):
17461745
assert actual.read() == expected.read()
17471746
zipped.close()
17481747
raw_zip.close()
1748+
1749+
def test_select_multiple_with_different_options_in_multiple_versions(self):
1750+
title, schemas, submissions = build_fixture('favorite_coffee')
1751+
fp = FormPack(schemas, title)
1752+
self.assertEqual(len(fp.versions), 2)
1753+
1754+
export = fp.export(versions=fp.versions.keys()).to_dict(submissions)
1755+
1756+
headers = export['Favorite coffee']['fields']
1757+
self.assertListEqual(headers, [
1758+
'favorite_coffee_type',
1759+
'favorite_coffee_type/french',
1760+
'favorite_coffee_type/italian',
1761+
'favorite_coffee_type/american',
1762+
'favorite_coffee_type/british',
1763+
'brand_of_coffee_machine'
1764+
])
1765+
1766+
# Check length of each row
1767+
for row in export['Favorite coffee']['data']:
1768+
self.assertEqual(len(headers), len(row))
1769+
1770+
# Ensure latest submissions is not shifted
1771+
self.assertListEqual(export['Favorite coffee']['data'][-1], [
1772+
'american british',
1773+
'0',
1774+
'0',
1775+
'1',
1776+
'1',
1777+
'Keurig'
1778+
])

0 commit comments

Comments
 (0)