(self)
| 288 | eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") |
| 289 | |
| 290 | def test_SafeTemplate(self): |
| 291 | eq = self.assertEqual |
| 292 | s = Template('$who likes ${what} for ${meal}') |
| 293 | eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') |
| 294 | eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') |
| 295 | eq(s.safe_substitute(dict(what='ham', meal='dinner')), |
| 296 | '$who likes ham for dinner') |
| 297 | eq(s.safe_substitute(dict(who='tim', what='ham')), |
| 298 | 'tim likes ham for ${meal}') |
| 299 | eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), |
| 300 | 'tim likes ham for dinner') |
| 301 | |
| 302 | def test_invalid_placeholders(self): |
| 303 | raises = self.assertRaises |
nothing calls this directly
no test coverage detected