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
90044275
Kaydet (Commit)
90044275
authored
Tem 11, 2007
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix some simple ctypes tests.
üst
982479de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
test_buffers.py
Lib/ctypes/test/test_buffers.py
+3
-3
test_byteswap.py
Lib/ctypes/test/test_byteswap.py
+1
-1
test_numbers.py
Lib/ctypes/test/test_numbers.py
+9
-8
No files found.
Lib/ctypes/test/test_buffers.py
Dosyayı görüntüle @
90044275
...
...
@@ -7,12 +7,12 @@ class StringBufferTestCase(unittest.TestCase):
b
=
create_string_buffer
(
32
)
self
.
failUnlessEqual
(
len
(
b
),
32
)
self
.
failUnlessEqual
(
sizeof
(
b
),
32
*
sizeof
(
c_char
))
self
.
failUnless
(
type
(
b
[
0
])
is
str
)
self
.
failUnless
(
type
(
b
[
0
])
is
str
8
)
b
=
create_string_buffer
(
"abc"
)
self
.
failUnlessEqual
(
len
(
b
),
4
)
# trailing nul char
self
.
failUnlessEqual
(
sizeof
(
b
),
4
*
sizeof
(
c_char
))
self
.
failUnless
(
type
(
b
[
0
])
is
str
)
self
.
failUnless
(
type
(
b
[
0
])
is
str
8
)
self
.
failUnlessEqual
(
b
[
0
],
"a"
)
self
.
failUnlessEqual
(
b
[:],
"abc
\0
"
)
...
...
@@ -20,7 +20,7 @@ class StringBufferTestCase(unittest.TestCase):
b
=
create_string_buffer
(
"abc"
)
self
.
failUnlessEqual
(
len
(
b
),
4
)
# trailing nul char
self
.
failUnlessEqual
(
sizeof
(
b
),
4
*
sizeof
(
c_char
))
self
.
failUnless
(
type
(
b
[
0
])
is
str
)
self
.
failUnless
(
type
(
b
[
0
])
is
str
8
)
self
.
failUnlessEqual
(
b
[
0
],
"a"
)
self
.
failUnlessEqual
(
b
[:],
"abc
\0
"
)
...
...
Lib/ctypes/test/test_byteswap.py
Dosyayı görüntüle @
90044275
...
...
@@ -4,7 +4,7 @@ from binascii import hexlify
from
ctypes
import
*
def
bin
(
s
):
return
hexlify
(
buffer
(
s
))
.
upper
()
return
str
(
hexlify
(
buffer
(
s
)
))
.
upper
()
# Each *simple* type that supports different byte orders has an
# __ctype_be__ attribute that specifies the same type in BIG ENDIAN
...
...
Lib/ctypes/test/test_numbers.py
Dosyayı görüntüle @
90044275
...
...
@@ -12,10 +12,10 @@ def valid_ranges(*types):
for
t
in
types
:
fmt
=
t
.
_type_
size
=
struct
.
calcsize
(
fmt
)
a
=
struct
.
unpack
(
fmt
,
(
"
\x00
"
*
32
)[:
size
])[
0
]
b
=
struct
.
unpack
(
fmt
,
(
"
\xFF
"
*
32
)[:
size
])[
0
]
c
=
struct
.
unpack
(
fmt
,
(
"
\x7F
"
+
"
\x00
"
*
32
)[:
size
])[
0
]
d
=
struct
.
unpack
(
fmt
,
(
"
\x80
"
+
"
\xFF
"
*
32
)[:
size
])[
0
]
a
=
struct
.
unpack
(
fmt
,
(
b
"
\x00
"
*
32
)[:
size
])[
0
]
b
=
struct
.
unpack
(
fmt
,
(
b
"
\xFF
"
*
32
)[:
size
])[
0
]
c
=
struct
.
unpack
(
fmt
,
(
b
"
\x7F
"
+
b
"
\x00
"
*
32
)[:
size
])[
0
]
d
=
struct
.
unpack
(
fmt
,
(
b
"
\x80
"
+
b
"
\xFF
"
*
32
)[:
size
])[
0
]
result
.
append
((
min
(
a
,
b
,
c
,
d
),
max
(
a
,
b
,
c
,
d
)))
return
result
...
...
@@ -174,13 +174,14 @@ class NumberTestCase(unittest.TestCase):
from
ctypes
import
c_char
from
array
import
array
a
=
array
(
'c'
,
'x'
)
a
=
array
(
'b'
,
[
0
])
a
[
0
]
=
ord
(
'x'
)
v
=
c_char
.
from_address
(
a
.
buffer_info
()[
0
])
self
.
failUnlessEqual
(
v
.
value
,
a
[
0
]
)
self
.
failUnlessEqual
(
v
.
value
,
'x'
)
self
.
failUnless
(
type
(
v
)
is
c_char
)
a
[
0
]
=
'?'
self
.
failUnlessEqual
(
v
.
value
,
a
[
0
]
)
a
[
0
]
=
ord
(
'?'
)
self
.
failUnlessEqual
(
v
.
value
,
'?'
)
# array does not support c_bool / 't'
# def test_bool_from_address(self):
...
...
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