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
4dc9c84e
Kaydet (Commit)
4dc9c84e
authored
Agu 05, 2011
tarafından
Sandro Tosi
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#11572: improvements to copy module tests along with removal of old test suite
üst
29f62976
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
65 deletions
+0
-65
copy.py
Lib/copy.py
+0
-65
test_copy.py
Lib/test/test_copy.py
+0
-0
No files found.
Lib/copy.py
Dosyayı görüntüle @
4dc9c84e
...
...
@@ -323,68 +323,3 @@ del types
# Helper for instance creation without calling __init__
class
_EmptyClass
:
pass
def
_test
():
l
=
[
None
,
1
,
2
,
3.14
,
'xyzzy'
,
(
1
,
2
),
[
3.14
,
'abc'
],
{
'abc'
:
'ABC'
},
(),
[],
{}]
l1
=
copy
(
l
)
print
(
l1
==
l
)
l1
=
map
(
copy
,
l
)
print
(
l1
==
l
)
l1
=
deepcopy
(
l
)
print
(
l1
==
l
)
class
C
:
def
__init__
(
self
,
arg
=
None
):
self
.
a
=
1
self
.
arg
=
arg
if
__name__
==
'__main__'
:
import
sys
file
=
sys
.
argv
[
0
]
else
:
file
=
__file__
self
.
fp
=
open
(
file
)
self
.
fp
.
close
()
def
__getstate__
(
self
):
return
{
'a'
:
self
.
a
,
'arg'
:
self
.
arg
}
def
__setstate__
(
self
,
state
):
for
key
,
value
in
state
.
items
():
setattr
(
self
,
key
,
value
)
def
__deepcopy__
(
self
,
memo
=
None
):
new
=
self
.
__class__
(
deepcopy
(
self
.
arg
,
memo
))
new
.
a
=
self
.
a
return
new
c
=
C
(
'argument sketch'
)
l
.
append
(
c
)
l2
=
copy
(
l
)
print
(
l
==
l2
)
print
(
l
)
print
(
l2
)
l2
=
deepcopy
(
l
)
print
(
l
==
l2
)
print
(
l
)
print
(
l2
)
l
.
append
({
l
[
1
]:
l
,
'xyz'
:
l
[
2
]})
l3
=
copy
(
l
)
import
reprlib
print
(
map
(
reprlib
.
repr
,
l
))
print
(
map
(
reprlib
.
repr
,
l1
))
print
(
map
(
reprlib
.
repr
,
l2
))
print
(
map
(
reprlib
.
repr
,
l3
))
l3
=
deepcopy
(
l
)
print
(
map
(
reprlib
.
repr
,
l
))
print
(
map
(
reprlib
.
repr
,
l1
))
print
(
map
(
reprlib
.
repr
,
l2
))
print
(
map
(
reprlib
.
repr
,
l3
))
class
odict
(
dict
):
def
__init__
(
self
,
d
=
{}):
self
.
a
=
99
dict
.
__init__
(
self
,
d
)
def
__setitem__
(
self
,
k
,
i
):
dict
.
__setitem__
(
self
,
k
,
i
)
self
.
a
o
=
odict
({
"A"
:
"B"
})
x
=
deepcopy
(
o
)
print
(
o
,
x
)
if
__name__
==
'__main__'
:
_test
()
Lib/test/test_copy.py
Dosyayı görüntüle @
4dc9c84e
This diff is collapsed.
Click to expand it.
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