Skip to content

Commit

Permalink
Use valid expressions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lognaturel committed May 18, 2021
1 parent 2278d05 commit 13ee243
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pyxform/tests_v1/test_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,14 +818,14 @@ def test_repeat_with_reference_path_in_a_method_with_spaces_in_predicate_uses_cu
| | calculate | pos1 | | position(..) |
| | begin repeat | rep5 | | |
| | calculate | pos5 | | position(..) |
| | calculate | item5 | | instance('item')/root/item[index=number(1+ ${pos5} and ${pos1} = 1]/label |
| | calculate | item5 | | instance('item')/root/item[index=number(1+ ${pos5}) and ${pos1} = 1]/label |
| | end repeat | | | |
"""
self.assertPyxformXform(
name="data",
md=xlsform_md,
xml__contains=[
"""<bind calculate="instance('item')/root/item[index=number(1+ current()/../pos5 and /data/pos1 = 1]/label" nodeset="/data/rep5/item5" type="string"/>""" # noqa pylint: disable=line-too-long
"""<bind calculate="instance('item')/root/item[index=number(1+ current()/../pos5 ) and /data/pos1 = 1]/label" nodeset="/data/rep5/item5" type="string"/>""" # noqa pylint: disable=line-too-long
],
)

Expand Down Expand Up @@ -953,19 +953,19 @@ def test_repeat_with_reference_path_after_instance_in_predicate_uses_current(sel
${pos5} that is in 'position()=${pos5}'' uses current because it is in a predicate (eventhough not in an instance)
"""
xlsform_md = """
| survey | | | | |
| | type | name | label | calculation |
| | xml-external | item | | |
| | begin repeat | rep5 | | |
| | calculate | pos5 | | position(..) |
| | calculate | item5 | | concat(instance('item')/root/item[index =${pos5}]/label, @data/form/[position()=${pos5}]/text |
| | end repeat | | | |
| survey | | | | |
| | type | name | label | calculation |
| | xml-external | item | | |
| | begin repeat | rep5 | | |
| | calculate | pos5 | | position(..) |
| | calculate | item5 | | concat(instance('item')/root/item[index =${pos5}]/label, /data[position()=${pos5}]/text) |
| | end repeat | | | |
"""
self.assertPyxformXform(
name="data",
md=xlsform_md,
xml__contains=[
"""<bind calculate="concat(instance('item')/root/item[index = current()/../pos5 ]/label, @data/form/[position()= current()/../pos5 ]/text" nodeset="/data/rep5/item5" type="string"/>""", # noqa pylint: disable=line-too-long
"""<bind calculate="concat(instance('item')/root/item[index = current()/../pos5 ]/label, /data[position()= current()/../pos5 ]/text)" nodeset="/data/rep5/item5" type="string"/>""", # noqa pylint: disable=line-too-long
],
)

Expand Down

0 comments on commit 13ee243

Please sign in to comment.