XLSForm / pyxform

A Python package to create XForms for ODK Collect.
BSD 2-Clause "Simplified" License
77 stars 134 forks source link

Case is lost when specifying custom values for select_one_from_file label and value #642

Closed lognaturel closed 1 year ago

lognaturel commented 1 year ago

Software and hardware versions

pyxform v1.12.0

Problem description

It is possible to specify custom elements/columns as label or value for use with select_one_from_file as documented here. Currently, pyxform sets all parameter keys and values to lowercase. In this case, case specified by the user should be preserved.

Steps to reproduce the problem

In tests/test_external_instances_for_selects.py:

    def test_param_value_case_preserved(self):
        """Should find that parameters value/label override the default itemset name/label with case preserved."""
        md = """
        | survey |                                        |         |         |                      |
        |        | type                                   | name    | label   | parameters           |
        |        | select_one_from_file cities{ext}       | city    | City    | value=VAL, label=lBl |
        """
        for ext, xp_city, xp_subs in self.xp_test_args:
            with self.subTest(msg=ext):
                self.assertPyxformXform(
                    name="test",
                    md=md.format(ext=ext),
                    xml__xpath_match=[
                        xp_city.model_external_instance_and_bind(),
                        xp_city.body_itemset_nodeset_and_refs(value="VAL", label="lBl"),
                    ],
                )

Form: geojson-case.xlsx Attachment: features.geojson.zip

Expected behavior

pyxform should pass through the case specified in the form definition.