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
c0b2b727
Kaydet (Commit)
c0b2b727
authored
Kas 18, 2003
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Test the applesingle decoder.
üst
c19c5a62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
test_applesingle.py
Lib/test/test_applesingle.py
+72
-0
No files found.
Lib/test/test_applesingle.py
0 → 100644
Dosyayı görüntüle @
c0b2b727
# Copyright (C) 2003 Python Software Foundation
import
unittest
import
macostools
import
Carbon.File
import
MacOS
import
os
import
sys
from
test
import
test_support
import
struct
import
applesingle
AS_MAGIC
=
0x00051600
AS_VERSION
=
0x00020000
dataforkdata
=
'hello
\r\0
world
\n
'
resourceforkdata
=
'goodbye
\n
cruel
\0
world
\r
'
applesingledata
=
struct
.
pack
(
"ll16sh"
,
AS_MAGIC
,
AS_VERSION
,
"foo"
,
2
)
+
\
struct
.
pack
(
"llllll"
,
1
,
50
,
len
(
dataforkdata
),
2
,
50
+
len
(
dataforkdata
),
len
(
resourceforkdata
))
+
\
dataforkdata
+
\
resourceforkdata
TESTFN2
=
test_support
.
TESTFN
+
'2'
class
TestApplesingle
(
unittest
.
TestCase
):
def
setUp
(
self
):
fp
=
open
(
test_support
.
TESTFN
,
'w'
)
fp
.
write
(
applesingledata
)
fp
.
close
()
def
tearDown
(
self
):
try
:
os
.
unlink
(
test_support
.
TESTFN
)
except
:
pass
try
:
os
.
unlink
(
TESTFN2
)
except
:
pass
def
compareData
(
self
,
isrf
,
data
):
if
isrf
:
fp
=
MacOS
.
openrf
(
TESTFN2
,
'*rb'
)
else
:
fp
=
open
(
TESTFN2
,
'rb'
)
filedata
=
fp
.
read
(
1000
)
self
.
assertEqual
(
data
,
filedata
)
def
test_applesingle
(
self
):
try
:
os
.
unlink
(
TESTFN2
)
except
:
pass
applesingle
.
decode
(
test_support
.
TESTFN
,
TESTFN2
)
self
.
compareData
(
False
,
dataforkdata
)
self
.
compareData
(
True
,
resourceforkdata
)
def
test_applesingle_resonly
(
self
):
try
:
os
.
unlink
(
TESTFN2
)
except
:
pass
applesingle
.
decode
(
test_support
.
TESTFN
,
TESTFN2
,
resonly
=
True
)
self
.
compareData
(
False
,
resourceforkdata
)
def
test_main
():
test_support
.
run_unittest
(
TestApplesingle
)
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