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
f80680d8
Kaydet (Commit)
f80680d8
authored
Şub 06, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Migrate remaining tests from UserDict.UserDict to collections.UserDict.
üst
554c8b85
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
14 deletions
+14
-14
mapping_tests.py
Lib/test/mapping_tests.py
+5
-5
test_builtin.py
Lib/test/test_builtin.py
+2
-2
test_cfgparser.py
Lib/test/test_cfgparser.py
+2
-2
test_dict.py
Lib/test/test_dict.py
+3
-3
test_extcall.py
Lib/test/test_extcall.py
+1
-1
test_funcattrs.py
Lib/test/test_funcattrs.py
+1
-1
No files found.
Lib/test/mapping_tests.py
Dosyayı görüntüle @
f80680d8
# tests common to dict and UserDict
import
unittest
import
UserDict
import
collections
class
BasicTestMappingProtocol
(
unittest
.
TestCase
):
...
...
@@ -438,11 +438,11 @@ class TestMappingProtocol(BasicTestMappingProtocol):
# self.assert_(type(dictlike.fromkeys('a')) is dictlike)
class
mydict
(
self
.
type2test
):
def
__new__
(
cls
):
return
UserDict
.
UserDict
()
return
collections
.
UserDict
()
ud
=
mydict
.
fromkeys
(
'ab'
)
self
.
assertEqual
(
ud
,
{
'a'
:
None
,
'b'
:
None
})
# FIXME: the following won't work with UserDict, because it's an old style class
# self.assert_(isinstance(ud,
UserDict
.UserDict))
# self.assert_(isinstance(ud,
collections
.UserDict))
self
.
assertRaises
(
TypeError
,
dict
.
fromkeys
)
class
Exc
(
Exception
):
pass
...
...
@@ -574,10 +574,10 @@ class TestHashMappingProtocol(TestMappingProtocol):
TestMappingProtocol
.
test_fromkeys
(
self
)
class
mydict
(
self
.
type2test
):
def
__new__
(
cls
):
return
UserDict
.
UserDict
()
return
collections
.
UserDict
()
ud
=
mydict
.
fromkeys
(
'ab'
)
self
.
assertEqual
(
ud
,
{
'a'
:
None
,
'b'
:
None
})
self
.
assert_
(
isinstance
(
ud
,
UserDict
.
UserDict
))
self
.
assert_
(
isinstance
(
ud
,
collections
.
UserDict
))
def
test_pop
(
self
):
TestMappingProtocol
.
test_pop
(
self
)
...
...
Lib/test/test_builtin.py
Dosyayı görüntüle @
f80680d8
...
...
@@ -5,7 +5,7 @@ from test.test_support import fcmp, TESTFN, unlink, run_unittest, \
run_with_locale
from
operator
import
neg
import
sys
,
warnings
,
random
,
UserDict
,
io
,
rational
import
sys
,
warnings
,
random
,
collections
,
io
,
rational
warnings
.
filterwarnings
(
"ignore"
,
"hex../oct.. of negative int"
,
FutureWarning
,
__name__
)
warnings
.
filterwarnings
(
"ignore"
,
"integer argument expected"
,
...
...
@@ -400,7 +400,7 @@ class BuiltinTest(unittest.TestCase):
# Verify locals stores (used by list comps)
eval
(
'[locals() for i in (2,3)]'
,
g
,
d
)
eval
(
'[locals() for i in (2,3)]'
,
g
,
UserDict
.
UserDict
())
eval
(
'[locals() for i in (2,3)]'
,
g
,
collections
.
UserDict
())
class
SpreadSheet
:
"Sample application showing nested, calculated lookups."
...
...
Lib/test/test_cfgparser.py
Dosyayı görüntüle @
f80680d8
import
ConfigParser
import
io
import
unittest
import
UserDict
import
collections
from
test
import
test_support
class
SortedDict
(
UserDict
.
UserDict
):
class
SortedDict
(
collections
.
UserDict
):
def
items
(
self
):
return
sorted
(
self
.
data
.
items
())
...
...
Lib/test/test_dict.py
Dosyayı görüntüle @
f80680d8
import
unittest
from
test
import
test_support
import
sys
,
UserDict
,
random
,
string
import
sys
,
collections
,
random
,
string
class
DictTest
(
unittest
.
TestCase
):
...
...
@@ -209,10 +209,10 @@ class DictTest(unittest.TestCase):
self
.
assert_
(
type
(
dictlike
()
.
fromkeys
(
'a'
))
is
dictlike
)
class
mydict
(
dict
):
def
__new__
(
cls
):
return
UserDict
.
UserDict
()
return
collections
.
UserDict
()
ud
=
mydict
.
fromkeys
(
'ab'
)
self
.
assertEqual
(
ud
,
{
'a'
:
None
,
'b'
:
None
})
self
.
assert_
(
isinstance
(
ud
,
UserDict
.
UserDict
))
self
.
assert_
(
isinstance
(
ud
,
collections
.
UserDict
))
self
.
assertRaises
(
TypeError
,
dict
.
fromkeys
)
class
Exc
(
Exception
):
pass
...
...
Lib/test/test_extcall.py
Dosyayı görüntüle @
f80680d8
from
test.test_support
import
verify
,
verbose
,
TestFailed
,
sortdict
from
UserList
import
UserList
from
UserDict
import
UserDict
from
collections
import
UserDict
def
e
(
a
,
b
):
print
(
a
,
b
)
...
...
Lib/test/test_funcattrs.py
Dosyayı görüntüle @
f80680d8
...
...
@@ -175,7 +175,7 @@ class ArbitraryFunctionAttrTest(FuncAttrsTest):
class
FunctionDictsTest
(
FuncAttrsTest
):
def
test_setting_dict_to_invalid
(
self
):
self
.
cannot_set_attr
(
self
.
b
,
'__dict__'
,
None
,
TypeError
)
from
UserDict
import
UserDict
from
collections
import
UserDict
d
=
UserDict
({
'known_attr'
:
7
})
self
.
cannot_set_attr
(
self
.
fi
.
a
.
__func__
,
'__dict__'
,
d
,
TypeError
)
...
...
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