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
示例#2
0
 def test_parse_template_no_template(self):
     expected = Literal(
         'Error: template function requires the format template: template()'
     )
     assert parse_template('form.question1', 'template()') == expected
示例#3
0
 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
示例#4
0
 def test_parse_template_no_template(self):
     expected = Literal('Error: template function requires the format template: template()')
     assert parse_template('form.question1', 'template()') == expected
示例#5
0
 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