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
c9f8f146
Kaydet (Commit)
c9f8f146
authored
Nis 09, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use TESTFN instead of /etc/passwd and /dev/null as test files.
üst
2095d248
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
test_array.py
Lib/test/test_array.py
+12
-5
No files found.
Lib/test/test_array.py
Dosyayı görüntüle @
c9f8f146
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Roger E. Masse
Roger E. Masse
"""
"""
import
array
import
array
from
test_support
import
verbose
from
test_support
import
verbose
,
TESTFN
,
unlink
def
main
():
def
main
():
...
@@ -12,9 +12,10 @@ def main():
...
@@ -12,9 +12,10 @@ def main():
for
type
in
([
'b'
,
'h'
,
'i'
,
'l'
,
'f'
,
'd'
]):
for
type
in
([
'b'
,
'h'
,
'i'
,
'l'
,
'f'
,
'd'
]):
testtype
(
type
,
1
)
testtype
(
type
,
1
)
unlink
(
TESTFN
)
def
testtype
(
type
,
example
):
def
testtype
(
type
,
example
):
a
=
array
.
array
(
type
)
a
=
array
.
array
(
type
)
a
.
append
(
example
)
a
.
append
(
example
)
...
@@ -27,10 +28,14 @@ def testtype(type, example):
...
@@ -27,10 +28,14 @@ def testtype(type, example):
a
.
byteswap
()
a
.
byteswap
()
if
a
.
typecode
==
'c'
:
if
a
.
typecode
==
'c'
:
f
=
open
(
'/etc/passwd'
,
'r'
)
f
=
open
(
TESTFN
,
"w"
)
f
.
write
(
"The quick brown fox jumps over the lazy dog.
\n
"
)
f
.
close
()
f
=
open
(
TESTFN
,
'r'
)
a
.
fromfile
(
f
,
10
)
a
.
fromfile
(
f
,
10
)
f
.
close
()
if
verbose
:
if
verbose
:
print
'char array with 10 bytes of
/etc/passwd
appended: '
,
a
print
'char array with 10 bytes of
TESTFN
appended: '
,
a
a
.
fromlist
([
'a'
,
'b'
,
'c'
])
a
.
fromlist
([
'a'
,
'b'
,
'c'
])
if
verbose
:
if
verbose
:
print
'char array with list appended: '
,
a
print
'char array with list appended: '
,
a
...
@@ -38,8 +43,9 @@ def testtype(type, example):
...
@@ -38,8 +43,9 @@ def testtype(type, example):
a
.
insert
(
0
,
example
)
a
.
insert
(
0
,
example
)
if
verbose
:
if
verbose
:
print
'array of
%
s after inserting another:'
%
a
.
typecode
,
a
print
'array of
%
s after inserting another:'
%
a
.
typecode
,
a
f
=
open
(
'/dev/null'
,
'w'
)
f
=
open
(
TESTFN
,
'w'
)
a
.
tofile
(
f
)
a
.
tofile
(
f
)
f
.
close
()
a
.
tolist
()
a
.
tolist
()
a
.
tostring
()
a
.
tostring
()
if
verbose
:
if
verbose
:
...
@@ -48,5 +54,6 @@ def testtype(type, example):
...
@@ -48,5 +54,6 @@ def testtype(type, example):
print
'array of
%
s converted to a string: '
\
print
'array of
%
s converted to a string: '
\
%
a
.
typecode
,
a
.
tostring
()
%
a
.
typecode
,
a
.
tostring
()
main
()
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