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
51af82cc
Kaydet (Commit)
51af82cc
authored
Ara 03, 2013
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add a test for complex symlinks.
üst
6e8bc503
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
test_pathlib.py
Lib/test/test_pathlib.py
+20
-9
No files found.
Lib/test/test_pathlib.py
Dosyayı görüntüle @
51af82cc
...
...
@@ -1093,20 +1093,21 @@ class _BasePathTest(object):
with
open
(
join
(
'dirC'
,
'dirD'
,
'fileD'
),
'wb'
)
as
f
:
f
.
write
(
b
"this is file D
\n
"
)
if
not
symlink_skip_reason
:
# Relative symlinks
os
.
symlink
(
'fileA'
,
join
(
'linkA'
))
os
.
symlink
(
'non-existing'
,
join
(
'brokenLink'
))
self
.
dirlink
(
'dirB'
,
join
(
'linkB'
))
self
.
dirlink
(
os
.
path
.
join
(
'..'
,
'dirB'
),
join
(
'dirA'
,
'linkC'
))
# This one goes upwards but doesn't create a loop
self
.
dirlink
(
os
.
path
.
join
(
'..'
,
'dirB'
),
join
(
'dirB'
,
'linkD'
))
if
os
.
name
==
'nt'
:
# Workaround for http://bugs.python.org/issue13772
def
dirlink
(
src
,
dest
):
def
dirlink
(
self
,
src
,
dest
):
os
.
symlink
(
src
,
dest
,
target_is_directory
=
True
)
else
:
def
dirlink
(
src
,
dest
):
def
dirlink
(
self
,
src
,
dest
):
os
.
symlink
(
src
,
dest
)
# Relative symlinks
os
.
symlink
(
'fileA'
,
join
(
'linkA'
))
os
.
symlink
(
'non-existing'
,
join
(
'brokenLink'
))
dirlink
(
'dirB'
,
join
(
'linkB'
))
dirlink
(
os
.
path
.
join
(
'..'
,
'dirB'
),
join
(
'dirA'
,
'linkC'
))
# This one goes upwards but doesn't create a loop
dirlink
(
os
.
path
.
join
(
'..'
,
'dirB'
),
join
(
'dirB'
,
'linkD'
))
def
assertSame
(
self
,
path_a
,
path_b
):
self
.
assertTrue
(
os
.
path
.
samefile
(
str
(
path_a
),
str
(
path_b
)),
...
...
@@ -1269,6 +1270,16 @@ class _BasePathTest(object):
p
=
P
(
BASE
,
'dirA'
,
'linkX'
,
'linkY'
,
'fileB'
)
self
.
_check_resolve_absolute
(
p
,
P
(
BASE
,
'dirB'
,
'fileB'
))
@with_symlinks
def
test_resolve_dot
(
self
):
# See https://bitbucket.org/pitrou/pathlib/issue/9/pathresolve-fails-on-complex-symlinks
p
=
self
.
cls
(
BASE
)
self
.
dirlink
(
'.'
,
join
(
'0'
))
self
.
dirlink
(
'0/0'
,
join
(
'1'
))
self
.
dirlink
(
'1/1'
,
join
(
'2'
))
q
=
p
/
'2'
self
.
assertEqual
(
q
.
resolve
(),
p
)
def
test_with
(
self
):
p
=
self
.
cls
(
BASE
)
it
=
p
.
iterdir
()
...
...
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