def test_parse_template_args_long(self): expected = Apply( Reference('template'), Literal('https://www.commcarehq.org/a/{}/reports/form_data/{}/'), Reference('$.domain'), Reference('$.id'), ) assert parse_template('form.id', 'template(https://www.commcarehq.org/a/{}/reports/form_data/{}/, $.domain, $.id)') == expected
def test_parse_template_no_template(self): expected = Literal( 'Error: template function requires the format template: template()' ) assert parse_template('form.question1', 'template()') == expected
def test_parse_template_args(self): expected = Apply(Reference('template'), Literal('my name is {}'), Reference('form.question2')) assert parse_template( 'form.question1', 'template(my name is {}, form.question2)') == expected
def test_parse_template_no_template(self): expected = Literal('Error: template function requires the format template: template()') assert parse_template('form.question1', 'template()') == expected
def test_parse_template_args(self): expected = Apply(Reference('template'), Literal('my name is {}'), Reference('form.question2')) assert parse_template('form.question1', 'template(my name is {}, form.question2)') == expected