Mercurial > hg > pyloader
diff tests/objects.py @ 15:0bea5297c156
introduce a more betterer test
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 27 May 2011 18:56:00 -0700 |
parents | eb81d6943f2e |
children | 362912842985 |
line wrap: on
line diff
--- a/tests/objects.py Fri May 27 18:43:14 2011 -0700 +++ b/tests/objects.py Fri May 27 18:56:00 2011 -0700 @@ -5,6 +5,16 @@ def stringsort(*strings): return ''.join(sorted(''.join(strings))) +class StringMunge(object): + def __init__(self, prefix, delimeter=':', callback=None): + self.delimeter = delimeter + self.prefix = prefix + self.callback = callback + def __call__(self, string): + if self.callback: + string = self.callback(string) + return self.prefix + self.delimeter + string + class Foo(object): def __init__(self, a, b): self.factor = a*100 + b