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
640f483c
Commit
640f483c
authored
Aug 23, 2000
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new test - like test_ntpath but without splitunc test cases
parent
877d62e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
Lib/test/test_dospath.py
Lib/test/test_dospath.py
+49
-0
No files found.
Lib/test/test_dospath.py
0 → 100644
View file @
640f483c
import
dospath
import
string
import
os
errors
=
0
def
tester
(
fn
,
wantResult
):
fn
=
string
.
replace
(
fn
,
"
\
\
"
,
"
\
\
\
\
"
)
gotResult
=
eval
(
fn
)
if
wantResult
!=
gotResult
:
print
"error!"
print
"evaluated: "
+
str
(
fn
)
print
"should be: "
+
str
(
wantResult
)
print
" returned: "
+
str
(
gotResult
)
print
""
global
errors
errors
=
errors
+
1
tester
(
'dospath.splitdrive("c:
\
\
foo
\
\
bar")'
,
(
'c:'
,
'
\
\
foo
\
\
bar'
))
tester
(
'dospath.splitdrive("c:/foo/bar")'
,
(
'c:'
,
'/foo/bar'
))
tester
(
'dospath.split("c:
\
\
foo
\
\
bar")'
,
(
'c:
\
\
foo'
,
'bar'
))
tester
(
'dospath.split("
\
\
\
\
conky
\
\
mountpoint
\
\
foo
\
\
bar")'
,
(
'
\
\
\
\
conky
\
\
mountpoint
\
\
foo'
,
'bar'
))
tester
(
'dospath.split("c:
\
\
")'
,
(
'c:
\
\
'
,
''
))
tester
(
'dospath.split("
\
\
\
\
conky
\
\
mountpoint
\
\
")'
,
(
'
\
\
\
\
conky
\
\
mountpoint'
,
''
))
tester
(
'dospath.split("c:/")'
,
(
'c:/'
,
''
))
tester
(
'dospath.split("//conky/mountpoint/")'
,
(
'//conky/mountpoint'
,
''
))
tester
(
'dospath.isabs("c:
\
\
")'
,
1
)
tester
(
'dospath.isabs("
\
\
\
\
conky
\
\
mountpoint
\
\
")'
,
1
)
tester
(
'dospath.isabs("
\
\
foo")'
,
1
)
tester
(
'dospath.isabs("
\
\
foo
\
\
bar")'
,
1
)
tester
(
'dospath.abspath("C:
\
\
")'
,
"C:
\
\
"
)
tester
(
'dospath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])'
,
"/home/swen"
)
tester
(
'dospath.commonprefix(["
\
\
home
\
\
swen
\
\
spam", "
\
\
home
\
\
swen
\
\
eggs"])'
,
"
\
\
home
\
\
swen
\
\
"
)
tester
(
'dospath.commonprefix(["/home/swen/spam", "/home/swen/spam"])'
,
"/home/swen/spam"
)
if
errors
:
print
str
(
errors
)
+
" errors."
else
:
print
"No errors. Thank your lucky stars."
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