Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
d4f7f609
Kaydet (Commit)
d4f7f609
authored
Tem 19, 2001
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add some test cases for ntpath.join().
üst
3b5e4d1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
test_ntpath.py
Lib/test/test_ntpath.py
+19
-3
No files found.
Lib/test/test_ntpath.py
Dosyayı görüntüle @
d4f7f609
import
ntpath
import
ntpath
from
test_support
import
verbose
from
test_support
import
verbose
,
TestFailed
import
os
import
os
errors
=
0
errors
=
0
def
tester
(
fn
,
wantResult
):
def
tester
(
fn
,
wantResult
):
global
errors
fn
=
fn
.
replace
(
"
\\
"
,
"
\\\\
"
)
fn
=
fn
.
replace
(
"
\\
"
,
"
\\\\
"
)
gotResult
=
eval
(
fn
)
gotResult
=
eval
(
fn
)
if
wantResult
!=
gotResult
:
if
wantResult
!=
gotResult
:
...
@@ -13,7 +14,6 @@ def tester(fn, wantResult):
...
@@ -13,7 +14,6 @@ def tester(fn, wantResult):
print
"should be: "
+
str
(
wantResult
)
print
"should be: "
+
str
(
wantResult
)
print
" returned: "
+
str
(
gotResult
)
print
" returned: "
+
str
(
gotResult
)
print
""
print
""
global
errors
errors
=
errors
+
1
errors
=
errors
+
1
tester
(
'ntpath.splitdrive("c:
\\
foo
\\
bar")'
,
tester
(
'ntpath.splitdrive("c:
\\
foo
\\
bar")'
,
...
@@ -50,7 +50,23 @@ tester('ntpath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])',
...
@@ -50,7 +50,23 @@ tester('ntpath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])',
tester
(
'ntpath.commonprefix(["/home/swen/spam", "/home/swen/spam"])'
,
tester
(
'ntpath.commonprefix(["/home/swen/spam", "/home/swen/spam"])'
,
"/home/swen/spam"
)
"/home/swen/spam"
)
tester
(
'ntpath.join("")'
,
''
)
tester
(
'ntpath.join("", "", "")'
,
''
)
tester
(
'ntpath.join("a")'
,
'a'
)
tester
(
'ntpath.join("/a")'
,
'/a'
)
tester
(
'ntpath.join("
\\
a")'
,
'
\\
a'
)
tester
(
'ntpath.join("a:")'
,
'a:'
)
tester
(
'ntpath.join("a:", "b")'
,
'a:b'
)
tester
(
'ntpath.join("a:", "/b")'
,
'a:/b'
)
tester
(
'ntpath.join("a:", "
\\
b")'
,
'a:
\\
b'
)
tester
(
'ntpath.join("a", "/b")'
,
'/b'
)
tester
(
'ntpath.join("a", "
\\
b")'
,
'
\\
b'
)
tester
(
'ntpath.join("a", "b", "c")'
,
'a
\\
b
\\
c'
)
tester
(
'ntpath.join("a
\\
", "b", "c")'
,
'a
\\
b
\\
c'
)
tester
(
'ntpath.join("a", "b
\\
", "c")'
,
'a
\\
b
\\
c'
)
tester
(
'ntpath.join("a", "b", "
\\
c")'
,
'
\\
c'
)
if
errors
:
if
errors
:
print
str
(
errors
)
+
" errors."
raise
TestFailed
(
str
(
errors
)
+
" errors."
)
elif
verbose
:
elif
verbose
:
print
"No errors. Thank your lucky stars."
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