http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10118
Revision: 10118 Author: valhallasw Date: 2012-04-16 11:15:16 +0000 (Mon, 16 Apr 2012) Log Message: ----------- Added test & assertion for bug #3514031
Modified Paths: -------------- trunk/pywikipedia/userinterfaces/transliteration.py
Added Paths: ----------- trunk/pywikipedia/tests/test_transliteration.py
Added: trunk/pywikipedia/tests/test_transliteration.py =================================================================== --- trunk/pywikipedia/tests/test_transliteration.py (rev 0) +++ trunk/pywikipedia/tests/test_transliteration.py 2012-04-16 11:15:16 UTC (rev 10118) @@ -0,0 +1,32 @@ +import os +transpath = os.path.join(os.path.split(__file__)[0], '..', 'userinterfaces', 'transliteration.py') +import imp +transliteration = imp.load_source('transliteration', transpath) + +def test_different_encodings(): + encodings="""ascii + big5 + cp874 + cp932 + cp936 + cp949 + cp950 + cp1250 + cp1251 + cp1252 + cp1253 + cp1254 + cp1255 + cp1256 + cp1257 + cp1258 + gb18030 + latin_1 + utf_8""" + encodings = [x.strip() for x in encodings.split()] + for encoding in encodings: + yield check_transliteration, encoding + +def check_transliteration(encoding): + tler = transliteration.transliterator(encoding) +
Property changes on: trunk/pywikipedia/tests/test_transliteration.py ___________________________________________________________________ Added: svn:keywords + Id *.c = svn:eol-style=native *.cpp = svn:eol-style=native *.h = svn:eol-style=native *.dsp = svn:eol-style=CRLF *.dsw = svn:eol-style=CRLF *.sh = svn:eol-style=native Added: svn:executable *.txt + svn:eol-style=native *.png = svn:mime-type=image/png *.jpg = svn:mime-type=image/jpeg Makefile = svn:eol-style=native Added: svn:eol-style + native
Modified: trunk/pywikipedia/userinterfaces/transliteration.py =================================================================== --- trunk/pywikipedia/userinterfaces/transliteration.py 2012-04-16 10:18:26 UTC (rev 10117) +++ trunk/pywikipedia/userinterfaces/transliteration.py 2012-04-16 11:15:16 UTC (rev 10118) @@ -1661,6 +1661,7 @@ value = self.trans[char] if value == "?": continue while value.encode(encoding, 'replace').decode(encoding) == "?" and value in self.trans: + assert(value != self.trans[value]) value = self.trans[value] self.trans[char] = value
pywikipedia-svn@lists.wikimedia.org