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
ca8dd918
Kaydet (Commit)
ca8dd918
authored
Agu 07, 2007
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix test case by converting dbm keys to bytes.
üst
f9b95d4d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
test_anydbm.py
Lib/test/test_anydbm.py
+12
-12
No files found.
Lib/test/test_anydbm.py
Dosyayı görüntüle @
ca8dd918
...
@@ -21,13 +21,13 @@ def _delete_files():
...
@@ -21,13 +21,13 @@ def _delete_files():
pass
pass
class
AnyDBMTestCase
(
unittest
.
TestCase
):
class
AnyDBMTestCase
(
unittest
.
TestCase
):
_dict
=
{
str8
(
'0'
)
:
b
''
,
_dict
=
{
'0'
:
b
''
,
str8
(
'a'
)
:
b
'Python:'
,
'a'
:
b
'Python:'
,
str8
(
'b'
)
:
b
'Programming'
,
'b'
:
b
'Programming'
,
str8
(
'c'
)
:
b
'the'
,
'c'
:
b
'the'
,
str8
(
'd'
)
:
b
'way'
,
'd'
:
b
'way'
,
str8
(
'f'
)
:
b
'Guido'
,
'f'
:
b
'Guido'
,
str8
(
'g'
)
:
b
'intended'
,
'g'
:
b
'intended'
,
}
}
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
*
args
):
...
@@ -37,14 +37,14 @@ class AnyDBMTestCase(unittest.TestCase):
...
@@ -37,14 +37,14 @@ class AnyDBMTestCase(unittest.TestCase):
f
=
anydbm
.
open
(
_fname
,
'c'
)
f
=
anydbm
.
open
(
_fname
,
'c'
)
self
.
assertEqual
(
list
(
f
.
keys
()),
[])
self
.
assertEqual
(
list
(
f
.
keys
()),
[])
for
key
in
self
.
_dict
:
for
key
in
self
.
_dict
:
f
[
key
]
=
self
.
_dict
[
key
]
f
[
key
.
encode
(
"ascii"
)
]
=
self
.
_dict
[
key
]
self
.
read_helper
(
f
)
self
.
read_helper
(
f
)
f
.
close
()
f
.
close
()
def
test_anydbm_modification
(
self
):
def
test_anydbm_modification
(
self
):
self
.
init_db
()
self
.
init_db
()
f
=
anydbm
.
open
(
_fname
,
'c'
)
f
=
anydbm
.
open
(
_fname
,
'c'
)
self
.
_dict
[
str8
(
'g'
)]
=
f
[
str8
(
'g'
)
]
=
b
"indented"
self
.
_dict
[
'g'
]
=
f
[
b
'g'
]
=
b
"indented"
self
.
read_helper
(
f
)
self
.
read_helper
(
f
)
f
.
close
()
f
.
close
()
...
@@ -63,16 +63,16 @@ class AnyDBMTestCase(unittest.TestCase):
...
@@ -63,16 +63,16 @@ class AnyDBMTestCase(unittest.TestCase):
def
read_helper
(
self
,
f
):
def
read_helper
(
self
,
f
):
keys
=
self
.
keys_helper
(
f
)
keys
=
self
.
keys_helper
(
f
)
for
key
in
self
.
_dict
:
for
key
in
self
.
_dict
:
self
.
assertEqual
(
self
.
_dict
[
key
],
f
[
key
])
self
.
assertEqual
(
self
.
_dict
[
key
],
f
[
key
.
encode
(
"ascii"
)
])
def
init_db
(
self
):
def
init_db
(
self
):
f
=
anydbm
.
open
(
_fname
,
'n'
)
f
=
anydbm
.
open
(
_fname
,
'n'
)
for
k
in
self
.
_dict
:
for
k
in
self
.
_dict
:
f
[
k
]
=
self
.
_dict
[
k
]
f
[
k
.
encode
(
"ascii"
)
]
=
self
.
_dict
[
k
]
f
.
close
()
f
.
close
()
def
keys_helper
(
self
,
f
):
def
keys_helper
(
self
,
f
):
keys
=
sorted
(
f
.
keys
())
keys
=
sorted
(
k
.
decode
(
"ascii"
)
for
k
in
f
.
keys
())
dkeys
=
sorted
(
self
.
_dict
.
keys
())
dkeys
=
sorted
(
self
.
_dict
.
keys
())
self
.
assertEqual
(
keys
,
dkeys
)
self
.
assertEqual
(
keys
,
dkeys
)
return
keys
return
keys
...
...
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