Skip to content

Commit

Permalink
fix: upgrade fixture-based test for instance_xmlns setting
Browse files Browse the repository at this point in the history
- The test was broken by changes to choices processing (XLSForm#603).
- The test conditions seem to relate only to the instance_xmlns feature.
- The new test asserts the same using the pyxformtestcase pattern.
  • Loading branch information
lindsay-stevens committed Apr 20, 2023
1 parent 88c71fa commit cf701eb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 82 deletions.
Binary file removed tests/example_xls/instance_xmlns_test.xls
Binary file not shown.
30 changes: 0 additions & 30 deletions tests/example_xls/instance_xmlns_test.xml

This file was deleted.

47 changes: 47 additions & 0 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from tests.pyxform_test_case import PyxformTestCase


class TestSettings(PyxformTestCase):

def test_instance_xmlns__is_set__custom_xmlns(self):
"""Should find the instance_xmlns value in the instance xmlns attribute."""
md = """
| settings |
| | instance_xmlns |
| | 1234 |
| survey | | | |
| | type | name | label |
| | text | q1 | hello |
"""
self.assertPyxformXform(
md=md,
xml__xpath_match=[
"""
/h:html/h:head/x:model/x:instance/*[
local-name()='test_name'
and @id='test_id'
and namespace-uri()='1234'
]
"""
]
)

def test_instance_xmlns__not_set__default_xmlns(self):
"""Should find the default xmlns for the instance element."""
md = """
| survey | | | |
| | type | name | label |
| | text | q1 | hello |
"""
self.assertPyxformXform(
md=md,
xml__xpath_match=[
"""
/h:html/h:head/x:model/x:instance/*[
local-name()='test_name'
and @id='test_id'
and namespace-uri()='http://www.w3.org/2002/xforms'
]
"""
],
)
52 changes: 0 additions & 52 deletions tests/tests_by_file.py

This file was deleted.

0 comments on commit cf701eb

Please sign in to comment.