Home | Trees | Indices | Help |
---|
|
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.translit 18 """ 19 20 21 __id__ = __revision__ = "$Id: test_translit.py 63 2007-01-02 09:22:16Z the.pythy $" 22 __url__ = "$URL: https://pythy.googlecode.com/svn/trunk/pytils/pytils/test/test_translit.py $" 23 24 import unittest 25 26 import pytils 2729 """ 30 Test case for pytils.translit 31 """ 32 38 44 50122 123 124 if __name__ == '__main__': 125 unittest.main() 12652 """ 53 Unit-test for transliterations 54 """ 55 self.ckTransl(u"тест", 'test') 56 self.ckTransl(u"проверка", 'proverka') 57 self.ckTransl(u"транслит", 'translit') 58 self.ckTransl(u"правда ли это", 'pravda li eto') 59 self.ckTransl(u"Щука", 'Schuka')6062 """ 63 Unit-test for testing translify's exceptions 64 """ 65 self.assertRaises(TypeError, pytils.translit.translify, 25) 66 self.assertRaises(ValueError, pytils.translit.translify, u'\u00bfHabla espa\u00f1ol?')6769 """ 70 Unit-test for detransliterations 71 """ 72 self.ckDetransl('test', u"тест") 73 self.ckDetransl('proverka', u"проверка") 74 self.ckDetransl('translit', u"транслит") 75 self.ckDetransl('SCHuka', u"Щука") 76 self.ckDetransl('Schuka', u"Щука")7779 """ 80 Unit-test for testing detranslify's exceptions 81 """ 82 self.assertRaises(TypeError, pytils.translit.detranslify, 25) 83 self.assertRaises(ValueError, pytils.translit.detranslify, "тест")8486 """ 87 Unit-test for slugs 88 """ 89 self.ckSlug(u"ТеСт", 'test') 90 self.ckSlug(u"Проверка связи", 'proverka-svyazi') 91 self.ckSlug(u"me&you", 'me-and-you') 92 self.ckSlug(u"и еще один тест", 'i-esche-odin-test')9395 """ 96 Unit-test for testing slugify's exceptions 97 """ 98 self.assertRaises(TypeError, pytils.translit.slugify, 25) 99 self.assertRaises(ValueError, pytils.translit.slugify, "тест")100102 """ 103 Unit-test for testing additional unicode symbols 104 """ 105 self.ckTransl(u"«Вот так вот»", '"Vot tak vot"') 106 self.ckTransl(u"‘Или вот так’", "'Ili vot tak'") 107 self.ckTransl(u"– Да…", "- Da...")108110 """ 111 Unit-test for testing that bug#10 fixed 112 """ 113 self.ckSlug(u"Проверка связи…", 'proverka-svyazi') 114 self.ckSlug(u"Проверка\x0aсвязи 2", 'proverka-svyazi-2') 115 self.ckSlug(u"Проверка\201связи 3", 'proverkasvyazi-3')116118 """ 119 Unit-test for testing that bug#15 fixed 120 """ 121 self.ckSlug(u"World of Warcraft", "world-of-warcraft")
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Tue Feb 27 09:42:56 2007 | http://epydoc.sourceforge.net |