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
d77e2eaa
Kaydet (Commit)
d77e2eaa
authored
Tem 14, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.2
üst
bf9c021d
6e18e042
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
test_byteswap.py
Lib/ctypes/test/test_byteswap.py
+12
-12
No files found.
Lib/ctypes/test/test_byteswap.py
Dosyayı görüntüle @
d77e2eaa
import
sys
,
unittest
,
struct
,
math
import
sys
,
unittest
,
struct
,
math
,
ctypes
from
binascii
import
hexlify
from
binascii
import
hexlify
from
ctypes
import
*
from
ctypes
import
*
...
@@ -188,16 +188,6 @@ class Test(unittest.TestCase):
...
@@ -188,16 +188,6 @@ class Test(unittest.TestCase):
# nested structures with different byteorders
# nested structures with different byteorders
# create nested structures with given byteorders and set memory to data
# create nested structures with given byteorders and set memory to data
def
set_structures
(
endianness
,
nested_endianness
,
data
):
class
NestedStructure
(
nested_endianness
):
_fields_
=
[(
"x"
,
c_uint32
),
(
"y"
,
c_uint32
)]
class
TestStructure
(
endianness
):
_fields_
=
[(
"point"
,
NestedStructure
)]
self
.
assertEqual
(
len
(
data
),
sizeof
(
TestStructure
))
return
cast
(
data
,
POINTER
(
TestStructure
))[
0
]
for
nested
,
data
in
(
for
nested
,
data
in
(
(
BigEndianStructure
,
b
'
\0\0\0\1\0\0\0\2
'
),
(
BigEndianStructure
,
b
'
\0\0\0\1\0\0\0\2
'
),
...
@@ -208,7 +198,17 @@ class Test(unittest.TestCase):
...
@@ -208,7 +198,17 @@ class Test(unittest.TestCase):
LittleEndianStructure
,
LittleEndianStructure
,
Structure
,
Structure
,
):
):
s
=
set_structures
(
parent
,
nested
,
data
)
class
NestedStructure
(
nested
):
_fields_
=
[(
"x"
,
c_uint32
),
(
"y"
,
c_uint32
)]
class
TestStructure
(
parent
):
_fields_
=
[(
"point"
,
NestedStructure
)]
self
.
assertEqual
(
len
(
data
),
sizeof
(
TestStructure
))
ptr
=
POINTER
(
TestStructure
)
s
=
cast
(
data
,
ptr
)[
0
]
del
ctypes
.
_pointer_type_cache
[
TestStructure
]
self
.
assertEqual
(
s
.
point
.
x
,
1
)
self
.
assertEqual
(
s
.
point
.
x
,
1
)
self
.
assertEqual
(
s
.
point
.
y
,
2
)
self
.
assertEqual
(
s
.
point
.
y
,
2
)
...
...
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