Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spelling and update failing tests #358

Merged
merged 3 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pyxform/tests_v1/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_duplicate_choice_list_with_setting(self):
"""

expected = """
<select1 ref="/pyxform_autotestname/S1">
<select1 ref="/pyxform_autotestname/S1">
<label>s1</label>
<item>
<label>a</label>
Expand All @@ -116,7 +116,7 @@ def test_duplicate_choice_list_with_setting(self):
</item>
</select1>
"""
self.assertPyxformXform(md=md, model__contins=[expected], run_odk_validate=True)
self.assertPyxformXform(md=md, xml__contains=[expected], run_odk_validate=True)

def test_choice_list_without_duplicates_is_successful(self):
md = """
Expand All @@ -133,7 +133,7 @@ def test_choice_list_without_duplicates_is_successful(self):
"""

expected = """
<select1 ref="/pyxform_autotestname/S1">
<select1 ref="/pyxform_autotestname/S1">
<label>s1</label>
<item>
<label>a</label>
Expand All @@ -145,4 +145,4 @@ def test_choice_list_without_duplicates_is_successful(self):
</item>
</select1>
"""
self.assertPyxformXform(md=md, model__contins=[expected], run_odk_validate=True)
self.assertPyxformXform(md=md, xml__contains=[expected], run_odk_validate=True)
24 changes: 11 additions & 13 deletions pyxform/tests_v1/test_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ def test_indexed_repeat_relative_path(self):
],
)

def test_hints_are_present_within_repeats(self):
"""Hints are present within repeats"""
def test_hints_are_not_present_within_repeats(self):
"""Hints are not present within repeats"""
md = """
| survey | | | | |
| | type | name | label | hint |
Expand All @@ -206,16 +206,14 @@ def test_hints_are_present_within_repeats(self):
""" # noqa

expected = """

<group ref="/Families/pets">
<group ref="/pyxform_autotestname/pets">
<label>Pets</label>
<hint>Pet details</hint>
<repeat nodeset="/Families/pets">
<input ref="/Families/pets/pets_name">
<label>Pet's Name</label>
<hint>Pets name hint</hint>
<repeat nodeset="/pyxform_autotestname/pets">
<input ref="/pyxform_autotestname/pets/pets_name">
<label>Pet's name</label>
<hint>Pet's name hint</hint>
</input>
<select1 ref="/Families/pets/pet_type">
<select1 ref="/pyxform_autotestname/pets/pet_type">
<label>Type of pet</label>
<hint>Type of pet hint</hint>
<item>
Expand All @@ -235,15 +233,15 @@ def test_hints_are_present_within_repeats(self):
<value>fish</value>
</item>
</select1>
<upload mediatype="image/*" ref="/Families/pets/pet_picture">
<upload mediatype="image/*" ref="/pyxform_autotestname/pets/pet_picture">
<label>Picture of pet</label>
<hint>Take a nice photo</hint>
</upload>
</repeat>
</group>
""" # noqa
"""

self.assertPyxformXform(md=md, model__contins=[expected], run_odk_validate=True)
self.assertPyxformXform(md=md, xml__contains=[expected], run_odk_validate=True)

def test_hints_are_present_within_groups(self):
"""Tests that hints are present within groups."""
Expand Down
12 changes: 5 additions & 7 deletions pyxform/tests_v1/test_support_external_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,12 @@ def test_external_choices_sheet_values_required(self):
| | cities | Kisumu |
| | cities | Mombasa |
"""
expected = [
"""<itemset nodeset="instance('cities')/root/item">
<value ref="name"/>
<label ref="label"/>
</itemset>"""
] # noqa
expected = """
<input query="instance('cities')/root/item[S1= /pyxform_autotestname/S1 and county= /pyxform_autotestname/county ]" ref="/pyxform_autotestname/city">
"""

self.assertPyxformXform(
md=md, debug=False, model__contins=[expected], run_odk_validate=True
md=md, debug=False, xml__contains=[expected], run_odk_validate=True
)

def test_list_name_not_in_external_choices_sheet_raises_error(self):
Expand Down