diff --git a/pyxform/tests/bug_example_xls/spaces_in_choices_header.xls b/pyxform/tests/bug_example_xls/spaces_in_choices_header.xls
index 42509ef4f..987ba5ff2 100644
Binary files a/pyxform/tests/bug_example_xls/spaces_in_choices_header.xls and b/pyxform/tests/bug_example_xls/spaces_in_choices_header.xls differ
diff --git a/pyxform/tests/bug_tests.py b/pyxform/tests/bug_tests.py
index 0cbd6d6f2..8063df362 100644
--- a/pyxform/tests/bug_tests.py
+++ b/pyxform/tests/bug_tests.py
@@ -202,6 +202,22 @@ def runTest(self):
pyxform.xls2json.parse_file_to_json(path_to_excel_file, warnings=warnings)
self.assertEquals(len(warnings), 3, "Found " + str(len(warnings)) + " warnings")
+ def test_values_with_spaces_are_cleaned(self):
+ """
+ Test that values with leading and trailing whitespaces are processed.
+
+ This test checks that the submission_url provided is cleaned
+ of leading and trailing whitespaces.
+ """
+ filename = "spaces_in_choices_header.xls"
+ path_to_excel_file = os.path.join(DIR, "bug_example_xls", filename)
+ survey_reader = SurveyReader(path_to_excel_file)
+ result = survey_reader.to_json_dict()
+
+ self.assertEqual(
+ result["submission_url"], "https://odk.ona.io/random_person/submission"
+ )
+
class TestChoiceNameAsType(unittest.TestCase):
def test_choice_name_as_type(self):
diff --git a/pyxform/tests_v1/test_whitespace.py b/pyxform/tests_v1/test_whitespace.py
index 69a02c17b..838e8ac08 100644
--- a/pyxform/tests_v1/test_whitespace.py
+++ b/pyxform/tests_v1/test_whitespace.py
@@ -17,3 +17,19 @@ def test_over_trim(self):
""",
xml__contains=[''],
)
+
+ def test_values_without_whitespaces_are_processed_successfully(self):
+ md = """
+ | survey | | | |
+ | | type | label | name |
+ | | text | Ignored | Var |
+ | settings | | | |
+ | | id_string | public_key | submission_url |
+ | | tutorial_encrypted | MIIB | https://odk.ona.io/random_person/submission |
+ """
+
+ survey = self.md_to_pyxform_survey(md_raw=md)
+ expected = """"""
+ xml = survey._to_pretty_xml()
+ self.assertEqual(1, xml.count(expected))
+ self.assertPyxformXform(md=md, xml__contains=expected, run_odk_validate=True)