def test_simple(self): with self.assertRaises(Target.NoSuchTargetError): Target.get_template('foo') template = Target.create_template( 'foo', ['var1:string', 'var2:raw', 'var3:list'], 'var1 is {var1} var2 is {var2} var3 is {var3} var1 again is {var1}') self.assertEquals(template, Target.get_template('foo')) triple_quote_string = """ var1 is 'foo' var2 is bar var3 is [ '1', '2' ] var1 again is 'foo' """ self.assertEquals(triple_quote_string, template.format(var1='foo', var2='bar', var3=['1', '2']))
def test_simple(self): with self.assertRaises(Target.NoSuchTargetError): Target.get_template('foo') template = Target.create_template( 'foo', ['var1:string', 'var2:raw', 'var3:list'], 'var1 is {var1} var2 is {var2} var3 is {var3} var1 again is {var1}' ) self.assertEquals(template, Target.get_template('foo')) triple_quote_string = """ var1 is 'foo' var2 is bar var3 is [ '1', '2' ] var1 again is 'foo' """ self.assertEquals( triple_quote_string, template.format(var1='foo', var2='bar', var3=['1', '2']))