cpython: 7cdc941d5180 (original) (raw)
Mercurial > cpython
changeset 92128:7cdc941d5180
Issue #22165: Fixed test_undecodable_filename on non-UTF-8 locales. [#22165]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Sun, 17 Aug 2014 12:21:06 +0300 |
parents | 3153a400b739(current diff)a894b629bbea(diff) |
children | dc77ad3a17aa |
files | |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-)[+] [-] Lib/test/test_httpservers.py 5 |
line wrap: on
line diff
--- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -272,6 +272,7 @@ class SimpleHTTPServerTestCase(BaseTestC @unittest.skipUnless(support.TESTFN_UNDECODABLE, 'need support.TESTFN_UNDECODABLE') def test_undecodable_filename(self):
enc = sys.getfilesystemencoding()[](#l1.7) filename = os.fsdecode(support.TESTFN_UNDECODABLE) + '.txt'[](#l1.8) with open(os.path.join(self.tempdir, filename), 'wb') as f:[](#l1.9) f.write(support.TESTFN_UNDECODABLE)[](#l1.10)
@@ -279,9 +280,9 @@ class SimpleHTTPServerTestCase(BaseTestC body = self.check_status_and_reason(response, 200) quotedname = urllib.parse.quote(filename, errors='surrogatepass') self.assertIn(('href="%s"' % quotedname)
.encode('utf-8', 'surrogateescape'), body)[](#l1.15)
.encode(enc, 'surrogateescape'), body)[](#l1.16) self.assertIn(('>%s<' % html.escape(filename))[](#l1.17)
.encode('utf-8', 'surrogateescape'), body)[](#l1.18)
.encode(enc, 'surrogateescape'), body)[](#l1.19) response = self.request(self.tempdir_name + '/' + quotedname)[](#l1.20) self.check_status_and_reason(response, 200,[](#l1.21) data=support.TESTFN_UNDECODABLE)[](#l1.22)