Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
 def format(self, string, **kwds):
     """
     Return a string formatted with kwds and configuration items
     """
     d = dict(self._config, **kwds)
     return format(string, **d)