Пример #1
0
 def test_template_variables_still_work_over_multiple_lines(self):
     template = Template(
         "Hello %firstname%!\n Is your lastname %lastname%?")
     template.variables = {'firstname': 'Michael', 'lastname': 'McMillan'}
     self.assertEqual(template.text,
                      'Hello Michael!\n Is your lastname McMillan?')
Пример #2
0
 def test_template_can_contain_percentage_sign_without_a_defined_variables(
         self):
     template = Template('Hello %greeting% 5% remains!')
     template.variables = {'greeting': 'there'}
     self.assertEqual(template.text, 'Hello there 5% remains!')
Пример #3
0
 def test_template_variable_can_be_used_multiple_times(self):
     template = Template('Hello %name%. Do you like the name %name%?')
     template.variables = {'name': 'Michael'}
     self.assertEqual(template.text,
                      'Hello Michael. Do you like the name Michael?')
Пример #4
0
 def test_template_can_replace_variables_with_values(self):
     template = Template('Hello %firstname% %lastname%!')
     template.variables = {'firstname': 'Michael', 'lastname': 'McMillan'}
     self.assertEqual(template.text, 'Hello Michael McMillan!')
Пример #5
0
 def test_template_variables_still_work_over_multiple_lines(self):
     template = Template("Hello %firstname%!\n Is your lastname %lastname%?")
     template.variables = {'firstname': 'Michael', 'lastname': 'McMillan'}
     self.assertEqual(template.text, 'Hello Michael!\n Is your lastname McMillan?')
Пример #6
0
 def test_template_variable_can_be_used_multiple_times(self):
     template = Template('Hello %name%. Do you like the name %name%?')
     template.variables = {'name': 'Michael'}
     self.assertEqual(template.text, 'Hello Michael. Do you like the name Michael?')
Пример #7
0
 def test_template_can_contain_percentage_sign_without_a_defined_variables(self):
     template = Template('Hello %greeting% 5% remains!')
     template.variables = {'greeting': 'there'}
     self.assertEqual(template.text, 'Hello there 5% remains!')
Пример #8
0
 def test_template_can_replace_variables_with_values(self):
     template = Template('Hello %firstname% %lastname%!')
     template.variables = {'firstname': 'Michael', 'lastname': 'McMillan'}
     self.assertEqual(template.text, 'Hello Michael McMillan!')