diff options
| author | JensDiemer <git@jensdiemer.de> | 2011-05-26 18:00:03 +0200 |
|---|---|---|
| committer | JensDiemer <git@jensdiemer.de> | 2011-05-26 18:00:03 +0200 |
| commit | 5549d55cf548f3b500f677638674655117dffa72 (patch) | |
| tree | bf71163a684b2e395258c1da3e91ce8320bdd7f7 /tests/test_macros.py | |
| parent | 9c8396bbeb859c4dc030a8b9848b14147b126d88 (diff) | |
| download | creole-restructure.tar.gz | |
* remove the support for callable macros. Only dict and modules are allowed.restructure
* No macros used as default in creole2html converting.
* macros gets arguments as real keyword arguments and not only the string as \"args\"
Diffstat (limited to 'tests/test_macros.py')
| -rw-r--r-- | tests/test_macros.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_macros.py b/tests/test_macros.py new file mode 100644 index 0000000..68e170b --- /dev/null +++ b/tests/test_macros.py @@ -0,0 +1,39 @@ +# coding: utf-8 + + +""" + Creole unittest macros + ~~~~~~~~~~~~~~~~~~~~~~ + + Note: all mecro functions must return unicode! + + :copyleft: 2008-2011 by python-creole team, see AUTHORS for more details. + :license: GNU GPL v3 or above, see LICENSE for more details. +""" + + +def test_macro1(**kwargs): + """ + >>> test_macro1(foo="bar") + u"[test macro1 - kwargs: foo='bar']" + + >>> test_macro1() + u'[test macro1 - kwargs: ]' + + >>> test_macro1(a=1,b=2) + u'[test macro1 - kwargs: a=1,b=2]' + """ + kwargs = u','.join([u'%s=%r' % (k, v) for k, v in sorted(kwargs.items())]) + return u"[test macro1 - kwargs: %s]" % kwargs + +def test_macro2(char, text): + """ + >>> test_macro2(char=u"|", text=u"a\\nb") + u'a|b' + """ + return char.join(text.split()) + + +if __name__ == "__main__": + import doctest + print doctest.testmod() |
