You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test_integer_max_pixels test looks for <bind nodeset="/data/my_image" type="binary" orx:max-pixels="640"/>. If this is changed to e.g. <qqqqind nodeset="/data/my_image" type="binary" orx:max-pixels="640"/> and the debug=True flag is added, the test fails as expected but the debug output shows <bind nodeset="/data/my_image" orx:max-pixels="640" type="binary"/>. Note that the attribute order is different.
If I modify the test to check for <bind nodeset="/data/my_image" orx:max-pixels="640" type="binary"/>, the test fails.
To reproduce, use nosetests pyxform.tests_v1.test_max_pixels.MaxPixelsTest
When I convert the form directly, I get <bind nodeset="/data/my_image" orx:max-pixels="640" type="binary"/>. This means the tests are not verifying the actual output, at least for some Python versions. I got the same output with Python v2.7.
The text was updated successfully, but these errors were encountered:
I'm pretty sure this is because assertPyxformXform uses ETree.fromstring and that xml.etree.ElementTree represents attributes as {namespace}name. For the test described, that means the three attributes are represented as nodeset, {https://openrosa.org/xforms}max-pixels, type. That sorts to [nodeset, type, {https://openrosa.org/xforms}max-pixels] which explains the order expected by the tests.
On the other hand, the Survey._to_pretty/ugly_xml methods use xml.dom.minidom which I believe pre-Python 3.8 sorts attribute names using the attribute namespace prefixes.
lognaturel
changed the title
Test debug output doesn't match what's actually compared
Test debug output doesn't match what's actually compared when attributes have explicit namespaces
Jan 8, 2020
No, unfortunately #415 does not close this. I'm not really sure whether we want to do anything about it. We could replace all minidom usage with etree, I think, but that would be a big lift. assertPyxformXform uses etree because it needs more granular control over the XML, I believe.
pyxform v0.15.1, Python 3.7.2
The
test_integer_max_pixels
test looks for<bind nodeset="/data/my_image" type="binary" orx:max-pixels="640"/>
. If this is changed to e.g.<qqqqind nodeset="/data/my_image" type="binary" orx:max-pixels="640"/>
and thedebug=True
flag is added, the test fails as expected but the debug output shows<bind nodeset="/data/my_image" orx:max-pixels="640" type="binary"/>
. Note that the attribute order is different.If I modify the test to check for
<bind nodeset="/data/my_image" orx:max-pixels="640" type="binary"/>
, the test fails.To reproduce, use
nosetests pyxform.tests_v1.test_max_pixels.MaxPixelsTest
When I convert the form directly, I get
<bind nodeset="/data/my_image" orx:max-pixels="640" type="binary"/>
. This means the tests are not verifying the actual output, at least for some Python versions. I got the same output with Python v2.7.The text was updated successfully, but these errors were encountered: