Skip to content

Commit 16cf6fa

Browse files
committed
Validate now rejects choices without labels
1 parent f832a41 commit 16cf6fa

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/test_choices_sheet.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def test_numeric_choice_names__for_dynamic_selects__allowed(self):
4747
],
4848
)
4949

50-
def test_choices_without_labels__for_static_selects__allowed(self):
50+
def test_choices_without_labels__for_static_selects__forbidden(self):
5151
"""
52-
Test choices without labels for static selects. Validate will NOT fail.
52+
Test choices without labels for static selects. Validate will fail.
5353
"""
5454
self.assertPyxformXform(
5555
md="""
@@ -75,13 +75,15 @@ def test_choices_without_labels__for_static_selects__allowed(self):
7575
]
7676
""",
7777
],
78+
odk_validate_error__contains=[
79+
"<label> node for itemset doesn't exist! [instance(choices)/root/item/label]"
80+
],
7881
)
7982

80-
def test_choices_without_labels__for_dynamic_selects__allowed_by_pyxform(self):
83+
def test_choices_without_labels__for_dynamic_selects__forbidden(self):
8184
"""
8285
Test choices without labels for dynamic selects. Validate will fail.
8386
"""
84-
# TODO: validate doesn't fail
8587
self.assertPyxformXform(
8688
md="""
8789
| survey | | | | |
@@ -106,6 +108,9 @@ def test_choices_without_labels__for_dynamic_selects__allowed_by_pyxform(self):
106108
]
107109
""",
108110
],
111+
odk_validate_error__contains=[
112+
"<label> node for itemset doesn't exist! [instance(choices)/root/item/label]"
113+
],
109114
)
110115

111116
def test_choices_extra_columns_output_order_matches_xlsform(self):
@@ -116,8 +121,8 @@ def test_choices_extra_columns_output_order_matches_xlsform(self):
116121
| | select_one choices | a | A |
117122
| choices | | | |
118123
| | list_name | name | label | geometry |
119-
| | choices | 1 | | 46.5841618 7.0801379 0 0 |
120-
| | choices | 2 | | 35.8805082 76.515057 0 0 |
124+
| | choices | 1 | one | 46.5841618 7.0801379 0 0 |
125+
| | choices | 2 | two | 35.8805082 76.515057 0 0 |
121126
"""
122127
self.assertPyxformXform(
123128
md=md,

0 commit comments

Comments
 (0)