summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-09-10 19:16:35 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-09-10 19:16:35 (GMT)
commit4dd3a50ca480eef7bd898cfbfef8377231e18ae9 (patch)
tree22245e9d3c5129dd1bd514ed844761c96297ae1c
parent6d5ec2474d13c0e87ad4e1cd72ff729df24fd92e (diff)
downloadcpython-4dd3a50ca480eef7bd898cfbfef8377231e18ae9.zip
cpython-4dd3a50ca480eef7bd898cfbfef8377231e18ae9.tar.gz
cpython-4dd3a50ca480eef7bd898cfbfef8377231e18ae9.tar.bz2
Read unidata_version from unicodedata module.
Delete old NormalizationTest.txt if it doesn't match unidata_version.
-rw-r--r--Lib/test/test_normalization.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py
index 99f8e4e..e9056cd 100644
--- a/Lib/test/test_normalization.py
+++ b/Lib/test/test_normalization.py
@@ -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