def test_apply_object_attributes_to_template_template_and_context(self): context = Context('mock-value') test_string = apply_object_attributes_to_template( 'templated string with placeholder: {value}', context) self.assertEqual(test_string, 'templated string with placeholder: mock-value')
def test_apply_object_attributes_to_template_no_context_and_template(self): with self.assertRaises(AttributeError): test_string = apply_object_attributes_to_template( 'This is a {templated} string.', None)
def test_apply_object_attributes_to_template_no_context_and_no_template( self): test_string = apply_object_attributes_to_template( 'This is not a templated string.', None) self.assertEqual(test_string, 'This is not a templated string.')