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
4b318180
Kaydet (Commit)
4b318180
authored
Mar 16, 2011
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.2
üst
04055f0c
07926f02
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
test_posixpath.py
Lib/test/test_posixpath.py
+63
-0
NEWS
Misc/NEWS
+5
-0
No files found.
Lib/test/test_posixpath.py
Dosyayı görüntüle @
4b318180
...
@@ -6,6 +6,11 @@ import os
...
@@ -6,6 +6,11 @@ import os
import
sys
import
sys
from
posixpath
import
realpath
,
abspath
,
dirname
,
basename
from
posixpath
import
realpath
,
abspath
,
dirname
,
basename
try
:
import
posix
except
ImportError
:
posix
=
None
# An absolute path to a temporary filename for testing. We can't rely on TESTFN
# An absolute path to a temporary filename for testing. We can't rely on TESTFN
# being an absolute path, so we need this.
# being an absolute path, so we need this.
...
@@ -150,6 +155,7 @@ class PosixPathTest(unittest.TestCase):
...
@@ -150,6 +155,7 @@ class PosixPathTest(unittest.TestCase):
def
test_islink
(
self
):
def
test_islink
(
self
):
self
.
assertIs
(
posixpath
.
islink
(
support
.
TESTFN
+
"1"
),
False
)
self
.
assertIs
(
posixpath
.
islink
(
support
.
TESTFN
+
"1"
),
False
)
self
.
assertIs
(
posixpath
.
lexists
(
support
.
TESTFN
+
"2"
),
False
)
f
=
open
(
support
.
TESTFN
+
"1"
,
"wb"
)
f
=
open
(
support
.
TESTFN
+
"1"
,
"wb"
)
try
:
try
:
f
.
write
(
b
"foo"
)
f
.
write
(
b
"foo"
)
...
@@ -225,6 +231,44 @@ class PosixPathTest(unittest.TestCase):
...
@@ -225,6 +231,44 @@ class PosixPathTest(unittest.TestCase):
def
test_ismount
(
self
):
def
test_ismount
(
self
):
self
.
assertIs
(
posixpath
.
ismount
(
"/"
),
True
)
self
.
assertIs
(
posixpath
.
ismount
(
"/"
),
True
)
self
.
assertIs
(
posixpath
.
ismount
(
b
"/"
),
True
)
def
test_ismount_non_existent
(
self
):
# Non-existent mountpoint.
self
.
assertIs
(
posixpath
.
ismount
(
ABSTFN
),
False
)
try
:
os
.
mkdir
(
ABSTFN
)
self
.
assertIs
(
posixpath
.
ismount
(
ABSTFN
),
False
)
finally
:
safe_rmdir
(
ABSTFN
)
@unittest.skipUnless
(
support
.
can_symlink
(),
"Test requires symlink support"
)
def
test_ismount_symlinks
(
self
):
# Symlinks are never mountpoints.
try
:
os
.
symlink
(
"/"
,
ABSTFN
)
self
.
assertIs
(
posixpath
.
ismount
(
ABSTFN
),
False
)
finally
:
os
.
unlink
(
ABSTFN
)
@unittest.skipIf
(
posix
is
None
,
"Test requires posix module"
)
def
test_ismount_different_device
(
self
):
# Simulate the path being on a different device from its parent by
# mocking out st_dev.
save_lstat
=
os
.
lstat
def
fake_lstat
(
path
):
st_ino
=
0
st_dev
=
0
if
path
==
ABSTFN
:
st_dev
=
1
st_ino
=
1
return
posix
.
stat_result
((
0
,
st_ino
,
st_dev
,
0
,
0
,
0
,
0
,
0
,
0
,
0
))
try
:
os
.
lstat
=
fake_lstat
self
.
assertIs
(
posixpath
.
ismount
(
ABSTFN
),
True
)
finally
:
os
.
lstat
=
save_lstat
def
test_expanduser
(
self
):
def
test_expanduser
(
self
):
self
.
assertEqual
(
posixpath
.
expanduser
(
"foo"
),
"foo"
)
self
.
assertEqual
(
posixpath
.
expanduser
(
"foo"
),
"foo"
)
...
@@ -254,6 +298,10 @@ class PosixPathTest(unittest.TestCase):
...
@@ -254,6 +298,10 @@ class PosixPathTest(unittest.TestCase):
with
support
.
EnvironmentVarGuard
()
as
env
:
with
support
.
EnvironmentVarGuard
()
as
env
:
env
[
'HOME'
]
=
'/'
env
[
'HOME'
]
=
'/'
self
.
assertEqual
(
posixpath
.
expanduser
(
"~"
),
"/"
)
self
.
assertEqual
(
posixpath
.
expanduser
(
"~"
),
"/"
)
# expanduser should fall back to using the password database
del
env
[
'HOME'
]
home
=
pwd
.
getpwuid
(
os
.
getuid
())
.
pw_dir
self
.
assertEqual
(
posixpath
.
expanduser
(
"~"
),
home
)
def
test_normpath
(
self
):
def
test_normpath
(
self
):
self
.
assertEqual
(
posixpath
.
normpath
(
""
),
"."
)
self
.
assertEqual
(
posixpath
.
normpath
(
""
),
"."
)
...
@@ -286,6 +334,16 @@ class PosixPathTest(unittest.TestCase):
...
@@ -286,6 +334,16 @@ class PosixPathTest(unittest.TestCase):
finally
:
finally
:
support
.
unlink
(
ABSTFN
)
support
.
unlink
(
ABSTFN
)
@unittest.skipUnless
(
hasattr
(
os
,
"symlink"
),
"Missing symlink implementation"
)
@skip_if_ABSTFN_contains_backslash
def
test_realpath_relative
(
self
):
try
:
os
.
symlink
(
posixpath
.
relpath
(
ABSTFN
+
"1"
),
ABSTFN
)
self
.
assertEqual
(
realpath
(
ABSTFN
),
ABSTFN
+
"1"
)
finally
:
support
.
unlink
(
ABSTFN
)
@unittest.skipUnless
(
hasattr
(
os
,
"symlink"
),
@unittest.skipUnless
(
hasattr
(
os
,
"symlink"
),
"Missing symlink implementation"
)
"Missing symlink implementation"
)
@skip_if_ABSTFN_contains_backslash
@skip_if_ABSTFN_contains_backslash
...
@@ -443,6 +501,11 @@ class PosixPathTest(unittest.TestCase):
...
@@ -443,6 +501,11 @@ class PosixPathTest(unittest.TestCase):
finally
:
finally
:
os
.
getcwdb
=
real_getcwdb
os
.
getcwdb
=
real_getcwdb
def
test_sameopenfile
(
self
):
fname
=
support
.
TESTFN
+
"1"
with
open
(
fname
,
"wb"
)
as
a
,
open
(
fname
,
"wb"
)
as
b
:
self
.
assertTrue
(
posixpath
.
sameopenfile
(
a
.
fileno
(),
b
.
fileno
()))
class
PosixCommonTest
(
test_genericpath
.
CommonTest
):
class
PosixCommonTest
(
test_genericpath
.
CommonTest
):
pathmodule
=
posixpath
pathmodule
=
posixpath
...
...
Misc/NEWS
Dosyayı görüntüle @
4b318180
...
@@ -236,6 +236,11 @@ Tools/Demos
...
@@ -236,6 +236,11 @@ Tools/Demos
Tests
Tests
-----
-----
- Issue #11503: improve test coverage of posixpath.py. Patch by Evan Dandrea.
- Issue #11505: improves test coverage of string.py. Patch by Alicia
Arlen.
- Issue #11548: Improve test coverage of the shutil module. Patch by
- Issue #11548: Improve test coverage of the shutil module. Patch by
Evan Dandrea.
Evan Dandrea.
...
...
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