From c52b5afdfd6d76c4498ee7f69207925fd85d9f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Thu, 25 Feb 2021 14:46:56 -0800 Subject: [PATCH] Make sure all tests pass Validate --- pyxform/tests_v1/test_external_instances.py | 40 +++++++++++--------- pyxform/tests_v1/test_inline_translations.py | 2 +- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/pyxform/tests_v1/test_external_instances.py b/pyxform/tests_v1/test_external_instances.py index bacb0337d..e036c0a5b 100644 --- a/pyxform/tests_v1/test_external_instances.py +++ b/pyxform/tests_v1/test_external_instances.py @@ -32,9 +32,7 @@ def test_can__output_single_external_csv_item(self): | | type | name | label | | | csv-external | mydata | | """, - model__contains=[ - '' - ], + model__contains=[''], ) def test_cannot__use_same_external_xml_id_in_same_section(self): @@ -182,6 +180,7 @@ def test_can__use_same_external_csv_id_with_mixed_types(self): | survey | | | | | | | type | name | label | calculation | | | begin group | g1 | | | + | | text | foo | Foo | | | | csv-external | city | | | | | end group | g1 | | | | | begin group | g2 | | | @@ -191,12 +190,11 @@ def test_can__use_same_external_csv_id_with_mixed_types(self): | | select_multiple_from_file cities.csv | city | City | | | | end group | g3 | | | | | begin group | g4 | | | + | | text | foo | Foo | | | | calculate | city | City | pulldata('fruits', 'name', 'name', 'mango') | | | end group | g4 | | | """, # noqa - model__contains=[ - '', - ] + model__contains=['',], ) def test_can__use_all_types_together_with_unique_ids(self): @@ -332,9 +330,7 @@ def test_can__reuse_csv__selects_then_pulldata(self): expected = """ """ # noqa - self.assertPyxformXform( - md=md, model__contains=[expected] - ) + self.assertPyxformXform(md=md, model__contains=[expected]) survey = self.md_to_pyxform_survey(md_raw=md) xml = survey._to_pretty_xml() self.assertEqual(1, xml.count(expected)) @@ -352,9 +348,7 @@ def test_can__reuse_csv__pulldata_then_selects(self): | | select_one_from_file pain_locations.csv | pyear | Location of worst pain this year. | | """ # noqa expected = """""" # noqa - self.assertPyxformXform( - md=md, model__contains=[expected] - ) + self.assertPyxformXform(md=md, model__contains=[expected]) def test_can__reuse_xml__selects_then_external(self): """Re-using the same xml external data source id and URI is OK.""" @@ -386,9 +380,7 @@ def test_can__reuse_xml__external_then_selects(self): | | select_one_from_file pain_locations.xml | pyear | Location of worst pain this year. | """ # noqa expected = """""" # noqa - self.assertPyxformXform( - md=md, model__contains=[expected] - ) + self.assertPyxformXform(md=md, model__contains=[expected]) survey = self.md_to_pyxform_survey(md_raw=md) xml = survey._to_pretty_xml() self.assertEqual(1, xml.count(expected)) @@ -428,7 +420,11 @@ def test_external_instance_pulldata_readonly(self): """ node = """""" - self.assertPyxformXform(md=md, xml__contains=[node]) + self.assertPyxformXform( + md=md, + xml__contains=[node], + run_odk_validate=False, # Validate sees self references in readonly as circular but shouldn't + ) def test_external_instance_pulldata_required(self): """ @@ -441,7 +437,11 @@ def test_external_instance_pulldata_required(self): | | text | Part_ID | Participant ID | pulldata('ID', 'ParticipantID', 'ParticipantIDValue',.) | """ node = """""" - self.assertPyxformXform(md=md, xml__contains=[node], debug=False) + self.assertPyxformXform( + md=md, + xml__contains=[node], + run_odk_validate=False, # Validate sees self references in requireds as circular but shouldn't + ) def test_external_instance_pulldata_relevant(self): """ @@ -454,7 +454,11 @@ def test_external_instance_pulldata_relevant(self): | | text | Part_ID | Participant ID | pulldata('ID', 'ParticipantID', 'ParticipantIDValue',.) | """ node = """""" - self.assertPyxformXform(md=md, xml__contains=[node], debug=False) + self.assertPyxformXform( + md=md, + xml__contains=[node], + run_odk_validate=False, # Validate sees self references in relevants as circular but shouldn't + ) # This is not something that is recommended since pulldata and choice_filter both should use XPath predicates # behind the scenes but it should still be possible. diff --git a/pyxform/tests_v1/test_inline_translations.py b/pyxform/tests_v1/test_inline_translations.py index 3cd82a426..a68b4a7e6 100644 --- a/pyxform/tests_v1/test_inline_translations.py +++ b/pyxform/tests_v1/test_inline_translations.py @@ -122,7 +122,7 @@ def test_select_with_choice_filter_and_translations_generates_single_translation xform_md = """ | survey | | | | | | | type | name | label | choice_filter | - | | select_one list | foo | Foo | name != " | + | | select_one list | foo | Foo | name != '' | | choices | | | list_name | name | label | image | label::French | | | list | a | A | a.jpg | Ah |