Package pytils :: Package test :: Package templatetags
[hide private]

Source Code for Package pytils.test.templatetags

 1  # -*- coding: utf-8 -*- 
 2  # PyTils - simple processing for russian strings 
 3  # Copyright (C) 2006-2007  Yury Yurevich 
 4  # 
 5  # http://gorod-omsk.ru/blog/pythy/projects/pytils/ 
 6  # 
 7  # This program is free software; you can redistribute it and/or 
 8  # modify it under the terms of the GNU General Public License 
 9  # as published by the Free Software Foundation, version 2 
10  # of the License. 
11  # 
12  # This program is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU General Public License for more details. 
16  """ 
17  Unit tests for pytils' templatetags for Django web framework 
18  """ 
19   
20  __id__ = __revision__ = "$Id: __init__.py 76 2007-02-27 15:38:53Z the.pythy $" 
21  __url__ = "$URL: https://pythy.googlecode.com/svn/trunk/pytils/pytils/test/templatetags/__init__.py $" 
22  __all__ = ["test_numeral", "test_dt", "test_translit"] 
23   
24  import unittest 
25   
26 -def get_suite():
27 """Return TestSuite for all unit-test of PyTils' templatetags""" 28 suite = unittest.TestSuite() 29 for module_name in __all__: 30 imported_module = __import__("pytils.test.templatetags."+module_name, 31 globals(), 32 locals(), 33 ["pytils.test.templatetags"]) 34 35 getter = getattr(imported_module, 'get_suite', False) 36 if getter: 37 suite.addTest(getter()) 38 39 loader = unittest.defaultTestLoader 40 suite.addTest(loader.loadTestsFromModule(imported_module)) 41 42 return suite
43
44 -def run(verbosity=1):
45 """Run all unit-test of PyTils' templatetags""" 46 suite = get_suite() 47 unittest.TextTestRunner(verbosity=verbosity).run(suite)
48 49 if __name__ == '__main__': 50 run(2) 51