Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
49b2086a
Commit
49b2086a
authored
May 28, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21493: Added test for ntpath.expanduser(). Original patch by
Claudiu Popa.
parent
30080fd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
Lib/test/test_ntpath.py
Lib/test/test_ntpath.py
+35
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_ntpath.py
View file @
49b2086a
...
...
@@ -213,6 +213,41 @@ class TestNtpath(unittest.TestCase):
check('
%
spam
%
bar
', '
%
sbar
' % snonascii)
check('
%
{}
%
bar
'.format(snonascii), '
ham
%
sbar
' % snonascii)
def test_expanduser(self):
tester('
ntpath
.
expanduser
(
"test"
)
', '
test
')
with test_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
...
...
Misc/NEWS
View file @
49b2086a
...
...
@@ -30,6 +30,9 @@ Library
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 #13355: random.triangular() no longer fails with a ZeroDivisionError
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment