Skip to content

Commit

Permalink
chg: move test_xlsform_headers.py tests into test_sheet_columns.py
Browse files Browse the repository at this point in the history
- these test modules are about the same topic
  • Loading branch information
lindsay-stevens committed Jan 15, 2025
1 parent 33d6801 commit 795ecff
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 63 deletions.
57 changes: 56 additions & 1 deletion tests/test_sheet_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ def test_case_insensitive_form_id_form_title(self):
xml__xpath_match=[xps.form_title("Welcome!"), xps.form_id("My Form")],
)

def test_form_id_variant(self):
md = """
| survey | | | |
| | type | name | label |
| | text | member_name | name |
| settings | | | |
| | id_string | version | form_id |
| | get_option_from_two_repeat_answer | vWvvk3GYzjXcJQyvTWELej | AUTO-v2-jef |
"""
self.assertPyxformXform(
md=md,
# setting 'id_string' is ignored.
xml__xpath_match=[
"""
/h:html/h:head/x:model/x:instance/x:test_name[
@id='AUTO-v2-jef'
and @version='vWvvk3GYzjXcJQyvTWELej'
]
"""
],
)


class TestSurveyColumns(PyxformTestCase):
"""
Expand Down Expand Up @@ -130,7 +152,6 @@ def test_column_case(self):
Ensure that column name is case insensitive
"""
self.assertPyxformXform(
name="mixedcasecolumns",
md="""
| Survey | | | |
| | Type | name | Label |
Expand All @@ -140,6 +161,40 @@ def test_column_case(self):
""",
)

def test_label_caps_alternatives(self):
"""
re: https://github.com/SEL-Columbia/pyxform/issues/76
Capitalization of 'label' column can lead to confusing errors.
"""

self.assertPyxformXform(
md="""
| survey | | | |
| | type | name | label |
| | note | q | Q |
""",
xml__xpath_match=["/h:html/h:body/x:input[./x:label='Q']"],
)
self.assertPyxformXform(
md="""
| survey | | | |
| | type | name | Label |
| | note | q | Q |
""",
xml__xpath_match=["/h:html/h:body/x:input[./x:label='Q']"],
)

def test_calculate_alias(self):
self.assertPyxformXform(
name="calculatealias",
md="""
| survey | | | | |
| | type | name | label | calculate |
| | decimal | amount | Counter | |
| | calculate | doubled | Doubled | ${amount} * 2 |
""",
)

def test_missing_survey_headers(self):
self.assertPyxformXform(
md="""
Expand Down
62 changes: 0 additions & 62 deletions tests/test_xlsform_headers.py

This file was deleted.

0 comments on commit 795ecff

Please sign in to comment.