http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11643
Revision: 11643 Author: valhallasw Date: 2013-06-12 18:47:03 +0000 (Wed, 12 Jun 2013) Log Message: ----------- + UI transliteration tests
Modified Paths: -------------- branches/rewrite/tests/ui_tests.py
Modified: branches/rewrite/tests/ui_tests.py =================================================================== --- branches/rewrite/tests/ui_tests.py 2013-06-12 17:53:51 UTC (rev 11642) +++ branches/rewrite/tests/ui_tests.py 2013-06-12 18:47:03 UTC (rev 11643) @@ -305,7 +305,24 @@
self.assertIsInstance(returned, unicode) self.assertEqual(returned, u"Заглавная_страница") + + class TestTransliterationUnix(unittest.TestCase): + def setUp(self): + patch() + newstdout.truncate(0) + newstderr.truncate(0) + newstdin.truncate(0)
+ def tearDown(self): + unpatch() + + def testOutputUnicodeText(self): + pywikibot.config.console_encoding = 'latin-1' + pywikibot.config.colorized_output = True + pywikibot.output(u"abcd АБГД αβγδ あいうえお") + self.assertEqual(newstdout.getvalue(), "") + self.assertEqual(newstderr.getvalue(), "abcd \x1b[33;1mA\x1b[0m\x1b[33;1mB\x1b[0m\x1b[33;1mG\x1b[0m\x1b[33;1mD\x1b[0m \x1b[33;1ma\x1b[0m\x1b[33;1mb\x1b[0m\x1b[33;1mg\x1b[0m\x1b[33;1md\x1b[0m \x1b[33;1ma\x1b[0m\x1b[33;1mi\x1b[0m\x1b[33;1mu\x1b[0m\x1b[33;1me\x1b[0m\x1b[33;1mo\x1b[0m\n\x1b[0m") + try: try: unittest.main()