diff --git a/pyxform/survey_element.py b/pyxform/survey_element.py index fd0baae0..df133163 100644 --- a/pyxform/survey_element.py +++ b/pyxform/survey_element.py @@ -428,10 +428,15 @@ def xml_label_and_hint(self) -> "List[DetachableElement]": msg = "The survey element named '%s' " "has no label or hint." % self.name if len(result) == 0: raise PyXFormError(msg) + # Guidance hint alone is not OK since they may be hidden by default. if not any((self.label, self.media, self.hint)) and self.guidance_hint: raise PyXFormError(msg) + # big-image must combine with image + if not ("image" in self.media) and "big-image" in self.media: + raise PyXFormError("You must specify an image in order to use big-image.") + return result def xml_bindings(self): diff --git a/tests/test_sheet_columns.py b/tests/test_sheet_columns.py index 106d5c04..4dc11c15 100644 --- a/tests/test_sheet_columns.py +++ b/tests/test_sheet_columns.py @@ -29,7 +29,7 @@ def test_missing_name_but_has_alias_of_name(self): errored=False, ) - def test_missing_label(self): + def test_label_or_hint__must_be_provided(self): self.assertPyxformXform( name="invalidcols", ss_structure={"survey": [{"type": "text", "name": "q1"}]}, @@ -63,6 +63,18 @@ def test_label_node_added_when_hint_given_but_no_label_value(self): xml__contains=prep_for_xml_contains(expected), ) + def test_big_image_invalid_if_no_image(self): + self.assertPyxformXform( + name="data", + md=""" + | survey | | | | + | | type | name | media::big-image | + | | text | c | m.png | + """, + errored=True, + error__contains=["must specify an image"], + ) + def test_column_case(self): """ Ensure that column name is case insensitive