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
aa3828aa
Kaydet (Commit)
aa3828aa
authored
Mar 25, 1999
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Basic regr tests for pickle/cPickle
üst
7c6a90de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
172 additions
and
0 deletions
+172
-0
test_cpickle
Lib/test/output/test_cpickle
+11
-0
test_pickle
Lib/test/output/test_pickle
+11
-0
test_cpickle.py
Lib/test/test_cpickle.py
+75
-0
test_pickle.py
Lib/test/test_pickle.py
+75
-0
No files found.
Lib/test/output/test_cpickle
0 → 100644
Dosyayı görüntüle @
aa3828aa
test_cpickle
dumps()
loads()
ok
loads() DATA
ok
dumps() binary
loads() binary
ok
loads() BINDATA
ok
Lib/test/output/test_pickle
0 → 100644
Dosyayı görüntüle @
aa3828aa
test_pickle
dumps()
loads()
ok
loads() DATA
ok
dumps() binary
loads() binary
ok
loads() BINDATA
ok
Lib/test/test_cpickle.py
0 → 100644
Dosyayı görüntüle @
aa3828aa
# Test the cPickle module
DATA
=
"""(lp0
I0
aL1L
aF2.0
ac__builtin__
complex
p1
(F3.0
F0.0
tp2
Rp3
a(S'abc'
p4
g4
(i__main__
C
p5
(dp6
S'foo'
p7
I1
sS'bar'
p8
I2
sbg5
tp9
ag9
aI5
a.
"""
BINDATA
=
']q
\000
(K
\000
L1L
\012
G@
\000\000\000\000\000\000\000
c__builtin__
\012
complex
\012
q
\001
(G@
\010\000\000\000\000\000\000
G
\000\000\000\000\000\000\000\000
tq
\002
Rq
\003
(U
\003
abcq
\004
h
\004
(c__main__
\012
C
\012
q
\005
oq
\006
}q
\007
(U
\003
fooq
\010
K
\001
U
\003
barq
\011
K
\002
ubh
\006
tq
\012
h
\012
K
\005
e.'
import
cPickle
class
C
:
def
__cmp__
(
self
,
other
):
return
cmp
(
self
.
__dict__
,
other
.
__dict__
)
import
__main__
__main__
.
C
=
C
def
dotest
():
c
=
C
()
c
.
foo
=
1
c
.
bar
=
2
x
=
[
0
,
1L
,
2.0
,
3.0
+
0
j
]
y
=
(
'abc'
,
'abc'
,
c
,
c
)
x
.
append
(
y
)
x
.
append
(
y
)
x
.
append
(
5
)
print
"dumps()"
s
=
cPickle
.
dumps
(
x
)
print
"loads()"
x2
=
cPickle
.
loads
(
s
)
if
x2
==
x
:
print
"ok"
else
:
print
"bad"
print
"loads() DATA"
x2
=
cPickle
.
loads
(
DATA
)
if
x2
==
x
:
print
"ok"
else
:
print
"bad"
print
"dumps() binary"
s
=
cPickle
.
dumps
(
x
,
1
)
print
"loads() binary"
x2
=
cPickle
.
loads
(
s
)
if
x2
==
x
:
print
"ok"
else
:
print
"bad"
print
"loads() BINDATA"
x2
=
cPickle
.
loads
(
BINDATA
)
if
x2
==
x
:
print
"ok"
else
:
print
"bad"
dotest
()
Lib/test/test_pickle.py
0 → 100644
Dosyayı görüntüle @
aa3828aa
# Test the pickle module
DATA
=
"""(lp0
I0
aL1L
aF2.0
ac__builtin__
complex
p1
(F3.0
F0.0
tp2
Rp3
a(S'abc'
p4
g4
(i__main__
C
p5
(dp6
S'foo'
p7
I1
sS'bar'
p8
I2
sbg5
tp9
ag9
aI5
a.
"""
BINDATA
=
']q
\000
(K
\000
L1L
\012
G@
\000\000\000\000\000\000\000
c__builtin__
\012
complex
\012
q
\001
(G@
\010\000\000\000\000\000\000
G
\000\000\000\000\000\000\000\000
tq
\002
Rq
\003
(U
\003
abcq
\004
h
\004
(c__main__
\012
C
\012
q
\005
oq
\006
}q
\007
(U
\003
fooq
\010
K
\001
U
\003
barq
\011
K
\002
ubh
\006
tq
\012
h
\012
K
\005
e.'
import
pickle
class
C
:
def
__cmp__
(
self
,
other
):
return
cmp
(
self
.
__dict__
,
other
.
__dict__
)
import
__main__
__main__
.
C
=
C
def
dotest
():
c
=
C
()
c
.
foo
=
1
c
.
bar
=
2
x
=
[
0
,
1L
,
2.0
,
3.0
+
0
j
]
y
=
(
'abc'
,
'abc'
,
c
,
c
)
x
.
append
(
y
)
x
.
append
(
y
)
x
.
append
(
5
)
print
"dumps()"
s
=
pickle
.
dumps
(
x
)
print
"loads()"
x2
=
pickle
.
loads
(
s
)
if
x2
==
x
:
print
"ok"
else
:
print
"bad"
print
"loads() DATA"
x2
=
pickle
.
loads
(
DATA
)
if
x2
==
x
:
print
"ok"
else
:
print
"bad"
print
"dumps() binary"
s
=
pickle
.
dumps
(
x
,
1
)
print
"loads() binary"
x2
=
pickle
.
loads
(
s
)
if
x2
==
x
:
print
"ok"
else
:
print
"bad"
print
"loads() BINDATA"
x2
=
pickle
.
loads
(
BINDATA
)
if
x2
==
x
:
print
"ok"
else
:
print
"bad"
dotest
()
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