Skip to content

Commit

Permalink
Add test for calculate item with default but no calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
gushil committed Jan 5, 2021
1 parent 71e9bb3 commit 211d575
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyxform/tests_v1/test_dynamic_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,18 @@ def test_default_date_not_considered_dynamic(self):
""",
xml__contains=["<foo>2020-01-01</foo>"],
)

def test_dynamic_default_on_calculate(self):
self.assertPyxformXform(
name="dynamic",
md="""
| survey | | | | | |
| | type | name | label | calculation | default |
| | calculate | r | | | random() + 0.5 |
| | calculate | one | | | if(${r} < 1,'A','B') |
""",
xml__contains=[
"""<setvalue event="odk-instance-first-load" ref="/dynamic/r" value="random() + 0.5"/>""",
"""<setvalue event="odk-instance-first-load" ref="/dynamic/one" value="if( /dynamic/r &lt; 1,'A','B')"/>""",
],
)

0 comments on commit 211d575

Please sign in to comment.