Пример #1
0
 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