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
090da4b6
Kaydet (Commit)
090da4b6
authored
Ock 29, 2003
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Moved aepack test code to the test suite.
üst
0502d89b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
40 deletions
+84
-40
aepack.py
Lib/plat-mac/aepack.py
+0
-40
test_aepack.py
Lib/test/test_aepack.py
+84
-0
No files found.
Lib/plat-mac/aepack.py
Dosyayı görüntüle @
090da4b6
...
...
@@ -343,43 +343,3 @@ def mkobjectfrommodule(dict, modulename):
if
classtype
:
newobj
.
__class__
=
classtype
return
newobj
def
_test
():
"""Test program. Pack and unpack various things"""
objs
=
[
'a string'
,
12
,
12.0
,
None
,
[
'a'
,
'list'
,
'of'
,
'strings'
],
{
'key1'
:
'value1'
,
'key2'
:
'value2'
},
Carbon
.
File
.
FSSpec
(
os
.
curdir
),
Carbon
.
File
.
FSSpec
(
os
.
curdir
)
.
NewAliasMinimal
(),
aetypes
.
Enum
(
'enum'
),
aetypes
.
Type
(
'type'
),
aetypes
.
Keyword
(
'kwrd'
),
aetypes
.
Range
(
1
,
10
),
aetypes
.
Comparison
(
1
,
'< '
,
10
),
aetypes
.
Logical
(
'not '
,
1
),
# Cannot do StyledText
# Cannot do AEText
aetypes
.
IntlText
(
0
,
0
,
'international text'
),
aetypes
.
IntlWritingCode
(
0
,
0
),
aetypes
.
QDPoint
(
50
,
100
),
aetypes
.
QDRectangle
(
50
,
100
,
150
,
200
),
aetypes
.
RGBColor
(
0x7000
,
0x6000
,
0x5000
),
aetypes
.
Unknown
(
'xxxx'
,
'unknown type data'
),
aetypes
.
Character
(
1
),
aetypes
.
Character
(
2
,
aetypes
.
Line
(
2
)),
]
for
o
in
objs
:
print
'BEFORE'
,
o
,
`o`
packed
=
pack
(
o
)
unpacked
=
unpack
(
packed
)
print
'AFTER '
,
unpacked
,
`unpacked`
import
sys
sys
.
exit
(
1
)
if
__name__
==
'__main__'
:
_test
()
Lib/test/test_aepack.py
0 → 100755
Dosyayı görüntüle @
090da4b6
# Copyright (C) 2003 Python Software Foundation
import
unittest
import
aepack
import
aetypes
import
os
from
test
import
test_support
class
TestAepack
(
unittest
.
TestCase
):
OBJECTS
=
[
aetypes
.
Enum
(
'enum'
),
aetypes
.
Type
(
'type'
),
aetypes
.
Keyword
(
'kwrd'
),
aetypes
.
Range
(
1
,
10
),
aetypes
.
Comparison
(
1
,
'< '
,
10
),
aetypes
.
Logical
(
'not '
,
1
),
aetypes
.
IntlText
(
0
,
0
,
'international text'
),
aetypes
.
IntlWritingCode
(
0
,
0
),
aetypes
.
QDPoint
(
50
,
100
),
aetypes
.
QDRectangle
(
50
,
100
,
150
,
200
),
aetypes
.
RGBColor
(
0x7000
,
0x6000
,
0x5000
),
aetypes
.
Unknown
(
'xxxx'
,
'unknown type data'
),
aetypes
.
Character
(
1
),
aetypes
.
Character
(
2
,
aetypes
.
Line
(
2
)),
]
def
test_roundtrip_string
(
self
):
o
=
'a string'
packed
=
aepack
.
pack
(
o
)
unpacked
=
aepack
.
unpack
(
packed
)
self
.
assertEqual
(
o
,
unpacked
)
def
test_roundtrip_int
(
self
):
o
=
12
packed
=
aepack
.
pack
(
o
)
unpacked
=
aepack
.
unpack
(
packed
)
self
.
assertEqual
(
o
,
unpacked
)
def
test_roundtrip_float
(
self
):
o
=
12.1
packed
=
aepack
.
pack
(
o
)
unpacked
=
aepack
.
unpack
(
packed
)
self
.
assertEqual
(
o
,
unpacked
)
def
test_roundtrip_None
(
self
):
o
=
None
packed
=
aepack
.
pack
(
o
)
unpacked
=
aepack
.
unpack
(
packed
)
self
.
assertEqual
(
o
,
unpacked
)
def
test_roundtrip_aeobjects
(
self
):
for
o
in
self
.
OBJECTS
:
packed
=
aepack
.
pack
(
o
)
unpacked
=
aepack
.
unpack
(
packed
)
self
.
assertEqual
(
repr
(
o
),
repr
(
unpacked
))
def
test_roundtrip_FSSpec
(
self
):
try
:
import
Carbon.File
except
:
return
o
=
Carbon
.
File
.
FSSpec
(
os
.
curdir
)
packed
=
aepack
.
pack
(
o
)
unpacked
=
aepack
.
unpack
(
packed
)
self
.
assertEqual
(
o
.
as_pathname
(),
unpacked
.
as_pathname
())
def
test_roundtrip_Alias
(
self
):
try
:
import
Carbon.File
except
:
return
o
=
Carbon
.
File
.
FSSpec
(
os
.
curdir
)
.
NewAliasMinimal
()
packed
=
aepack
.
pack
(
o
)
unpacked
=
aepack
.
unpack
(
packed
)
self
.
assertEqual
(
o
.
FSResolveAlias
(
None
)[
0
]
.
as_pathname
(),
unpacked
.
FSResolveAlias
(
None
)[
0
]
.
as_pathname
())
def
test_main
():
test_support
.
run_unittest
(
TestAepack
)
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