[Python-checkins] cpython (merge 3.4 -> default): Issue #21493: Added test for ntpath.expanduser(). Original patch by
serhiy.storchaka
python-checkins at python.org
Wed May 28 17:16:18 CEST 2014
http://hg.python.org/cpython/rev/5a71a7e60fe6
changeset: 90881:5a71a7e60fe6
parent: 90878:c69e8ea3bf10
parent: 90880:a981a088512c
user: Serhiy Storchaka <storchaka at gmail.com>
date: Wed May 28 18:14:03 2014 +0300
summary:
Issue #21493: Added test for ntpath.expanduser(). Original patch by
Claudiu Popa.
files:
Lib/test/test_ntpath.py | 35 +++++++++++++++++++++++++++++
Misc/NEWS | 7 ++++-
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -258,6 +258,41 @@
check('%spam%bar', '%sbar' % nonascii)
check('%{}%bar'.format(nonascii), 'ham%sbar' % nonascii)
+ def test_expanduser(self):
+ tester('ntpath.expanduser("test")', 'test')
+
+ with support.EnvironmentVarGuard() as env:
+ env.clear()
+ tester('ntpath.expanduser("~test")', '~test')
+
+ env['HOMEPATH'] = 'eric\\idle'
+ env['HOMEDRIVE'] = 'C:\\'
+ tester('ntpath.expanduser("~test")', 'C:\\eric\\test')
+ tester('ntpath.expanduser("~")', 'C:\\eric\\idle')
+
+ del env['HOMEDRIVE']
+ tester('ntpath.expanduser("~test")', 'eric\\test')
+ tester('ntpath.expanduser("~")', 'eric\\idle')
+
+ env.clear()
+ env['USERPROFILE'] = 'C:\\eric\\idle'
+ tester('ntpath.expanduser("~test")', 'C:\\eric\\test')
+ tester('ntpath.expanduser("~")', 'C:\\eric\\idle')
+
+ env.clear()
+ env['HOME'] = 'C:\\idle\\eric'
+ tester('ntpath.expanduser("~test")', 'C:\\idle\\test')
+ tester('ntpath.expanduser("~")', 'C:\\idle\\eric')
+
+ tester('ntpath.expanduser("~test\\foo\\bar")',
+ 'C:\\idle\\test\\foo\\bar')
+ tester('ntpath.expanduser("~test/foo/bar")',
+ 'C:\\idle\\test/foo/bar')
+ tester('ntpath.expanduser("~\\foo\\bar")',
+ 'C:\\idle\\eric\\foo\\bar')
+ tester('ntpath.expanduser("~/foo/bar")',
+ 'C:\\idle\\eric/foo/bar')
+
def test_abspath(self):
# ntpath.abspath() can only be used on a system with the "nt" module
# (reasonably), so we protect this test with "import nt". This allows
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,8 +15,6 @@
time issue noticeable when compiling code with a large number of "and"
and "or" operators.
-- Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok.
-
- Issue #21418: Fix a crash in the builtin function super() when called without
argument and without current frame (ex: embedded Python).
@@ -511,6 +509,11 @@
Tests
-----
+- Issue #21493: Added test for ntpath.expanduser(). Original patch by
+ Claudiu Popa.
+
+- Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok.
+
- Issue #21522: Added Tkinter tests for Listbox.itemconfigure(),
PanedWindow.paneconfigure(), and Menu.entryconfigure().
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list