diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-15 18:08:58 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-15 18:08:58 (GMT) |
commit | 3cc8f211ed0d569836114d0d54c6298a21e6dde3 (patch) | |
tree | f3ceb6af8296b5cdb6d4e8860df240db5e208ac0 /Lib/test/test_normalization.py | |
parent | fae23dc9dc1b4e1b3138b1c933306869440408f2 (diff) | |
download | cpython-3cc8f211ed0d569836114d0d54c6298a21e6dde3.zip cpython-3cc8f211ed0d569836114d0d54c6298a21e6dde3.tar.gz cpython-3cc8f211ed0d569836114d0d54c6298a21e6dde3.tar.bz2 |
Issue #7783 and #7787: open_urlresource invalidates the outdated files from the local cache.
Use this feature to fix test_normalization.
Diffstat (limited to 'Lib/test/test_normalization.py')
-rw-r--r-- | Lib/test/test_normalization.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py index f9f4f68..2c49720 100644 --- a/Lib/test/test_normalization.py +++ b/Lib/test/test_normalization.py @@ -6,15 +6,12 @@ import sys import os from unicodedata import normalize, unidata_version -TESTDATAFILE = "NormalizationTest" + os.extsep + "txt" +TESTDATAFILE = "NormalizationTest.txt" 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) +def check_version(testfile): + hdr = testfile.readline() + return unidata_version in hdr class RangeError(Exception): pass @@ -40,13 +37,14 @@ def unistr(data): class NormalizationTest(unittest.TestCase): def test_main(self): + part = None part1_data = {} # Hit the exception early try: - open_urlresource(TESTDATAURL) + testdata = open_urlresource(TESTDATAURL, check_version) except (IOError, HTTPException): self.skipTest("Could not retrieve " + TESTDATAURL) - for line in open_urlresource(TESTDATAURL): + for line in testdata: if '#' in line: line = line.split('#')[0] line = line.strip() |