]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Read unidata_version from unicodedata module.
authorMartin v. Löwis <martin@v.loewis.de>
Wed, 10 Sep 2008 19:16:35 +0000 (19:16 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Wed, 10 Sep 2008 19:16:35 +0000 (19:16 +0000)
Delete old NormalizationTest.txt if it doesn't match
unidata_version.

Lib/test/test_normalization.py

index 99f8e4efb6fc6b0419d62b18217e733a22893df9..e9056cda0a68b31b67299e1335c87a62f4fb24c5 100644 (file)
@@ -3,10 +3,17 @@ import unittest
 
 import sys
 import os
-from unicodedata import normalize
+from unicodedata import normalize, unidata_version
 
 TESTDATAFILE = "NormalizationTest" + os.extsep + "txt"
-TESTDATAURL = "http://www.unicode.org/Public/5.1.0/ucd/" + TESTDATAFILE
+TESTDATAURL = "http://www.unicode.org/Public/" + unidata_version + "/ucd/" + TESTDATAFILE
+
+if os.path.exists(TESTDATAFILE):
+    f = open(TESTDATAFILE)
+    l = f.readline()
+    f.close()
+    if not unidata_version in l:
+        os.unlink(TESTDATAFILE)
 
 class RangeError(Exception):
     pass