def test_format(): kwds = dict(a='one', b='two') trials = [ ('{a}_{b}', 'one_two'), ] for give, want in trials: got = format(give, **kwds) assert want == got, 'Want: "%s", got: "%s"' % (want, got) got = format_get(give, kwds.get) assert want == got, 'Want: "%s", got: "%s"' % (want, got)
def format(self, string, **kwds): """ Return a string formatted with kwds and configuration items """ d = dict(self._config, **kwds) return format(string, **d)