Skip to content

Commit

Permalink
fix: OsmUploadQuestion fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ukanga committed Jan 28, 2025
1 parent 854ffe6 commit 0847036
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyxform/question.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
SELECT_QUESTION_FIELDS = (*QUESTION_FIELDS, *SELECT_QUESTION_EXTRA_FIELDS)

OSM_QUESTION_EXTRA_FIELDS = (constants.CHILDREN,)
OSM_QUESTION_FIELDS = (*QUESTION_FIELDS, *SELECT_QUESTION_EXTRA_FIELDS)
OSM_QUESTION_FIELDS = (*QUESTION_FIELDS, *OSM_QUESTION_EXTRA_FIELDS)

OPTION_EXTRA_FIELDS = (
"_choice_itext_id",
Expand Down
9 changes: 9 additions & 0 deletions tests/test_osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Test OSM widgets.
"""

from pyxform.builder import create_survey_element_from_dict
from pyxform.question import OsmUploadQuestion

from tests.pyxform_test_case import PyxformTestCase

expected_xml_output = """
Expand Down Expand Up @@ -54,3 +57,9 @@ def test_osm_type_with_list_underscore_name(self):
""",
xml__contains=[expected_xml_output],
)

def test_osm_type_to_json_dict(self):
osm_dict = {"type": "osm", "name": "osm_road", "label": "Road"}
osm_question = create_survey_element_from_dict(osm_dict)
self.assertTrue(isinstance(osm_question, OsmUploadQuestion))
self.assertEqual(osm_question.to_json_dict(), osm_dict)

0 comments on commit 0847036

Please sign in to comment.