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
a86700ae
Kaydet (Commit)
a86700ae
authored
Kas 27, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #22609: Revert changes in UserDict. They conflicted with existing tests.
üst
ae5cb214
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
28 deletions
+2
-28
__init__.py
Lib/collections/__init__.py
+1
-8
test_collections.py
Lib/test/test_collections.py
+1
-20
No files found.
Lib/collections/__init__.py
Dosyayı görüntüle @
a86700ae
...
...
@@ -893,14 +893,7 @@ class ChainMap(MutableMapping):
class
UserDict
(
MutableMapping
):
# Start by filling-out the abstract methods
def
__init__
(
*
args
,
**
kwargs
):
if
not
args
:
raise
TypeError
(
"descriptor '__init__' of 'UserDict' object "
"needs an argument"
)
self
,
*
args
=
args
if
len
(
args
)
>
1
:
raise
TypeError
(
'expected at most 1 arguments, got
%
d'
%
len
(
args
))
dict
=
args
[
0
]
if
args
else
None
def
__init__
(
self
,
dict
=
None
,
**
kwargs
):
self
.
data
=
{}
if
dict
is
not
None
:
self
.
update
(
dict
)
...
...
Lib/test/test_collections.py
Dosyayı görüntüle @
a86700ae
...
...
@@ -1571,24 +1571,6 @@ class SubclassMappingTests(mapping_tests.BasicTestMappingProtocol):
d
=
self
.
_empty_mapping
()
self
.
assertRaises
(
KeyError
,
d
.
popitem
)
class
TestUserDict
(
unittest
.
TestCase
):
def
test_init
(
self
):
self
.
assertEqual
(
list
(
UserDict
(
self
=
42
)
.
items
()),
[(
'self'
,
42
)])
self
.
assertEqual
(
list
(
UserDict
(
dict
=
42
)
.
items
()),
[(
'dict'
,
42
)])
self
.
assertEqual
(
list
(
UserDict
(
dict
=
None
)
.
items
()),
[(
'dict'
,
None
)])
self
.
assertRaises
(
TypeError
,
UserDict
,
42
)
self
.
assertRaises
(
TypeError
,
UserDict
,
(),
())
self
.
assertRaises
(
TypeError
,
UserDict
.
__init__
)
def
test_update
(
self
):
d
=
UserDict
()
d
.
update
(
self
=
42
)
self
.
assertEqual
(
list
(
d
.
items
()),
[(
'self'
,
42
)])
self
.
assertRaises
(
TypeError
,
UserDict
()
.
update
,
42
)
self
.
assertRaises
(
TypeError
,
UserDict
()
.
update
,
{},
{})
self
.
assertRaises
(
TypeError
,
UserDict
.
update
)
################################################################################
### Run tests
...
...
@@ -1600,8 +1582,7 @@ def test_main(verbose=None):
NamedTupleDocs
=
doctest
.
DocTestSuite
(
module
=
collections
)
test_classes
=
[
TestNamedTuple
,
NamedTupleDocs
,
TestOneTrickPonyABCs
,
TestCollectionABCs
,
TestCounter
,
TestChainMap
,
TestOrderedDict
,
GeneralMappingTests
,
SubclassMappingTests
,
TestUserDict
,]
TestOrderedDict
,
GeneralMappingTests
,
SubclassMappingTests
]
support
.
run_unittest
(
*
test_classes
)
support
.
run_doctest
(
collections
,
verbose
)
...
...
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