Skip to content

Commit

Permalink
Merge pull request #245 from ukanga/validate-v1.10.3
Browse files Browse the repository at this point in the history
Upgrade to ODK Validate v1.10.3
  • Loading branch information
ukanga authored Dec 9, 2018
2 parents 405b5fa + 023a321 commit 754b424
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 26 deletions.
65 changes: 39 additions & 26 deletions pyxform/tests_v1/test_guidance_hint.py
Original file line number Diff line number Diff line change
@@ -1,66 +1,76 @@
# -*- coding: utf-8 -*-
"""GUidnace hint test module."""
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase


class GuidanceHintTest(PyxformTestCase):
"""Test guidance_hint XLSForms."""

def test_hint_only(self):
"""Test hint only column."""
self.assertPyxformXform(
name="data",
md="""
| survey | | | | |
| | type | name | label | hint |
| | string | name | Name | your name |
""",
xml__contains=[
'<hint>your name</hint>'
]
xml__contains=["<hint>your name</hint>"],
)

def test_guidance_hint_and_label(self):
"""Test guidance_hint with label"""
self.assertPyxformXform(
name="data",
md="""
| survey | | | | |
| | type | name | label | guidance_hint |
| | string | name | Name | as shown on birth certificate|
""",
""", # noqa
xml__contains=[
'<hint ref="jr:itext(\'/data/name:hint\')"/>',
'<value form=\"guidance\">as shown on birth certificate</value>',
'<hint ref="jr:itext(\'/data/name:hint\')"/>'
]
"<hint ref=\"jr:itext('/data/name:hint')\"/>",
'<value form="guidance">as shown on birth certificate</value>',
"<hint ref=\"jr:itext('/data/name:hint')\"/>",
],
run_odk_validate=True,
)

def test_hint_and_guidance_one_language(self):
def test_hint_and_guidance_one_language(self): # pylint: disable=C0103
"""Test guidance_hint in one language."""
self.assertPyxformXform(
name="data",
md="""
| survey | | | | | |
| | type | name | label | hint | guidance_hint |
| | string | name | Name | your name | as shown on birth certificate|
""",
""", # noqa
xml__contains=[
'<hint ref="jr:itext(\'/data/name:hint\')"/>',
'<value>your name</value>',
'<value form=\"guidance\">as shown on birth certificate</value>'],
"<hint ref=\"jr:itext('/data/name:hint')\"/>",
"<value>your name</value>",
'<value form="guidance">as shown on birth certificate</value>',
],
)

def test_multi_language_guidance(self):
"""Test guidance_hint in multiple languages."""
self.assertPyxformXform(
name="data",
md="""
| survey | | | | | | |
| | type | name | label | hint | guidance_hint | guidance_hint::French (fr) |
| | string | name | Name | your name | as shown on birth certificate| comme sur le certificat de naissance|
""",
""", # noqa
xml__contains=[
'<translation lang="French (fr)">',
'<value form=\"guidance\">comme sur le certificat de naissance</value>',
'<value form="guidance">comme sur le certificat de naissance</value>', # noqa
'<translation default="true()" lang="default">',
'<value form=\"guidance\">as shown on birth certificate</value>',
'<hint ref="jr:itext(\'/data/name:hint\')"/>'],
'<value form="guidance">as shown on birth certificate</value>',
"<hint ref=\"jr:itext('/data/name:hint')\"/>",
],
)

def test_guidance_hint_only(self):
"""Test guidance_hint only."""
self.assertPyxformXform(
name="data",
errored=True,
Expand All @@ -70,34 +80,37 @@ def test_guidance_hint_only(self):
| | string | name | as shown on birth certificate|
""",
error__contains=[
'The survey element named \'name\' has no label or hint.'],
"The survey element named 'name' has no label or hint."
],
)


def test_multi_language_guidance_only(self):
def test_multi_language_guidance_only(self): # pylint:disable=C0103
"""Test guidance_hint only in multiple languages."""
self.assertPyxformXform(
name="data",
errored=True,
md="""
| survey | | | | |
| | type | name | guidance_hint | guidance_hint::French (fr) |
| | string | name | as shown on birth certificate| comme sur le certificat de naissance|
""",
""", # noqa
error__contains=[
'The survey element named \'name\' has no label or hint.'],
"The survey element named 'name' has no label or hint."
],
)

def test_multi_language_hint(self):
"""Test hint in multiple languages."""
self.assertPyxformXform(
name="data",
md="""
| survey | | | | |
| | type | name | hint | hint::French (fr) |
| | string | name | default language hint| French hint |
""",
""", # noqa
xml__contains=[
"<hint ref=\"jr:itext('/data/name:hint')\"/>",
"<value>French hint</value>",
"<value>default language hint</value>"
],
)
"<value>default language hint</value>",
],
)
Binary file modified pyxform/validators/odk_validate/bin/ODK_Validate.jar
Binary file not shown.

0 comments on commit 754b424

Please sign in to comment.