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
2a605346
Kaydet (Commit)
2a605346
authored
Mar 17, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
move SharedKeyTests to test_descr
üst
df813791
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
test_descr.py
Lib/test/test_descr.py
+23
-1
test_types.py
Lib/test/test_types.py
+2
-24
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
2a605346
...
...
@@ -4974,11 +4974,33 @@ class PicklingTests(unittest.TestCase):
self
.
_assert_is_copy
(
obj
,
objcopy2
)
class
SharedKeyTests
(
unittest
.
TestCase
):
@support.cpython_only
def
test_subclasses
(
self
):
# Verify that subclasses can share keys (per PEP 412)
class
A
:
pass
class
B
(
A
):
pass
a
,
b
=
A
(),
B
()
self
.
assertEqual
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
(
vars
(
b
)))
self
.
assertLess
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
({}))
a
.
x
,
a
.
y
,
a
.
z
,
a
.
w
=
range
(
4
)
self
.
assertNotEqual
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
(
vars
(
b
)))
a2
=
A
()
self
.
assertEqual
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
(
vars
(
a2
)))
self
.
assertLess
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
({}))
b
.
u
,
b
.
v
,
b
.
w
,
b
.
t
=
range
(
4
)
self
.
assertLess
(
sys
.
getsizeof
(
vars
(
b
)),
sys
.
getsizeof
({}))
def
test_main
():
# Run all local test cases, with PTypesLongInitTest first.
support
.
run_unittest
(
PTypesLongInitTest
,
OperatorsTest
,
ClassPropertiesAndMethods
,
DictProxyTests
,
MiscTests
,
PicklingTests
)
MiscTests
,
PicklingTests
,
SharedKeyTests
)
if
__name__
==
"__main__"
:
test_main
()
Lib/test/test_types.py
Dosyayı görüntüle @
2a605346
# Python test set -- part 6, built-in types
from
test.support
import
run_unittest
,
run_with_locale
,
cpython_only
from
test.support
import
run_unittest
,
run_with_locale
import
collections
import
pickle
import
locale
...
...
@@ -1170,31 +1170,9 @@ class SimpleNamespaceTests(unittest.TestCase):
self
.
assertEqual
(
ns
,
ns_roundtrip
,
pname
)
class
SharedKeyTests
(
unittest
.
TestCase
):
@cpython_only
def
test_subclasses
(
self
):
# Verify that subclasses can share keys (per PEP 412)
class
A
:
pass
class
B
(
A
):
pass
a
,
b
=
A
(),
B
()
self
.
assertEqual
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
(
vars
(
b
)))
self
.
assertLess
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
({}))
a
.
x
,
a
.
y
,
a
.
z
,
a
.
w
=
range
(
4
)
self
.
assertNotEqual
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
(
vars
(
b
)))
a2
=
A
()
self
.
assertEqual
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
(
vars
(
a2
)))
self
.
assertLess
(
sys
.
getsizeof
(
vars
(
a
)),
sys
.
getsizeof
({}))
b
.
u
,
b
.
v
,
b
.
w
,
b
.
t
=
range
(
4
)
self
.
assertLess
(
sys
.
getsizeof
(
vars
(
b
)),
sys
.
getsizeof
({}))
def
test_main
():
run_unittest
(
TypesTests
,
MappingProxyTests
,
ClassCreationTests
,
SimpleNamespaceTests
,
SharedKeyTests
)
SimpleNamespaceTests
)
if
__name__
==
'__main__'
:
test_main
()
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