Skip to content
Open
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
6 changes: 1 addition & 5 deletions pyxform/xls2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,11 +841,7 @@ def workbook_to_json(
and question_type not in aliases.label_optional_types
and not row.get("bind", {}).get("calculate")
and not row.get("_dynamic_default", False)
and not (
control_type is constants.GROUP
and row.get("control", {}).get("appearance")
== constants.FIELD_LIST
)
and (control_type is not constants.GROUP)
):
# Row number, name, and type probably enough for user message.
# Also means the error message text is stable for tests.
Expand Down
37 changes: 9 additions & 28 deletions tests/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,14 @@ def test_unlabeled_group(self):
| | text | my-text | my-text |
| | end_group | | |
""",
warnings_count=1,
warnings__contains=["[row : 2] Group has no label"],
warnings_count=0,
xml__xpath_match=[
"""
/h:html/h:body/x:group[
@ref = '/test_name/my-group'
]
"""
],
)

def test_unlabeled_group_alternate_syntax(self):
Expand All @@ -665,41 +671,16 @@ def test_unlabeled_group_alternate_syntax(self):
| | text | my-text | my-text |
| | end group | | |
""",
warnings_count=1,
warnings__contains=["[row : 2] Group has no label"],
)

def test_unlabeled_group_fieldlist(self):
self.assertPyxformXform(
md="""
| survey |
| | type | name | label | appearance |
| | begin_group | my-group | | field-list |
| | text | my-text | my-text | |
| | end_group | | | |
""",
warnings_count=0,
xml__xpath_match=[
"""
/h:html/h:body/x:group[
@ref = '/test_name/my-group' and @appearance='field-list'
@ref = '/test_name/my-group'
]
"""
],
)

def test_unlabeled_group_fieldlist_alternate_syntax(self):
self.assertPyxformXform(
md="""
| survey |
| | type | name | label::English (en) | appearance |
| | begin group | my-group | | field-list |
| | text | my-text | my-text | |
| | end group | | | |
""",
warnings_count=0,
)


class TestGroupInternalRepresentations(TestCase):
maxDiff = None
Expand Down
2 changes: 0 additions & 2 deletions tests/test_xlsform_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ def test_warnings__count(self):
vc.INVALID_LABEL.format(row=6),
vc.INVALID_LABEL.format(row=7),
"[row : 9] Repeat has no label: {'name': 'repeat_test', 'type': 'begin repeat'}",
"[row : 10] Group has no label: {'name': 'group_test', 'type': 'begin group'}",
"[row : 17] Group has no label: {'name': 'name', 'type': 'begin group'}",
"[row : 28] Use the max-pixels parameter to speed up submission "
+ "sending and save storage space. Learn more: https://xlsform.org/#image",
]
Expand Down