Skip to content

Commit f0fc33c

Browse files
add: put relative path tests in odk validate scope
- check that the survey structure in each case generates a valid XForm
1 parent 4b86953 commit f0fc33c

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/test_survey.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pyxform.section import GroupedSection, RepeatingSection
88
from pyxform.survey import Survey, share_same_repeat_parent
99

10-
from tests.pyxform_test_case import PyxformTestCase
10+
from tests.pyxform_test_case import PYXFORM_TESTS_RUN_ODK_VALIDATE, PyxformTestCase
1111

1212

1313
class TestSurvey(PyxformTestCase):
@@ -131,8 +131,8 @@ def build_survey_from_path_spec(
131131
shared_path = target_path[:shared_path_length]
132132

133133
# Objects always present once in paths.
134-
target = InputQuestion(name="t", type="string")
135-
source = InputQuestion(name="s", type="string")
134+
target = InputQuestion(name="t", label="target", type="string")
135+
source = InputQuestion(name="s", label="source ${t}", type="string")
136136
lcar = RepeatingSection(name="a")
137137
survey = Survey(name="data")
138138
current_parent = survey
@@ -209,7 +209,11 @@ def assert_relative_path(
209209
expect_none = expect_none == "1"
210210
msg = (target_xpath, source_xpath, reference_parent, expected, expect_none)
211211

212-
with self.subTest(msg=msg):
212+
if PYXFORM_TESTS_RUN_ODK_VALIDATE:
213+
with self.subTest(msg=f"ODK Validate: {msg}"):
214+
survey.to_xml(validate=True)
215+
216+
with self.subTest(msg=f"Output Test: {msg}"):
213217
relation = source.lowest_common_ancestor(
214218
other=target, group_type=const.REPEAT
215219
)

0 commit comments

Comments
 (0)