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
0dcd80a6
Kaydet (Commit)
0dcd80a6
authored
Agu 02, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #20557: Use specific asserts in io tests.
üst
ce17f764
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
18 deletions
+20
-18
test_bufio.py
Lib/test/test_bufio.py
+1
-1
test_file.py
Lib/test/test_file.py
+2
-2
test_fileio.py
Lib/test/test_fileio.py
+3
-3
test_io.py
Lib/test/test_io.py
+10
-10
test_memoryio.py
Lib/test/test_memoryio.py
+4
-2
No files found.
Lib/test/test_bufio.py
Dosyayı görüntüle @
0dcd80a6
...
@@ -34,7 +34,7 @@ class BufferSizeTest:
...
@@ -34,7 +34,7 @@ class BufferSizeTest:
line
=
f
.
readline
()
line
=
f
.
readline
()
self
.
assertEqual
(
line
,
s
)
self
.
assertEqual
(
line
,
s
)
line
=
f
.
readline
()
line
=
f
.
readline
()
self
.
assert
True
(
not
line
)
# Must be at EOF
self
.
assert
False
(
line
)
# Must be at EOF
f
.
close
()
f
.
close
()
finally
:
finally
:
support
.
unlink
(
support
.
TESTFN
)
support
.
unlink
(
support
.
TESTFN
)
...
...
Lib/test/test_file.py
Dosyayı görüntüle @
0dcd80a6
...
@@ -83,8 +83,8 @@ class AutoFileTests:
...
@@ -83,8 +83,8 @@ class AutoFileTests:
def
testErrors
(
self
):
def
testErrors
(
self
):
f
=
self
.
f
f
=
self
.
f
self
.
assertEqual
(
f
.
name
,
TESTFN
)
self
.
assertEqual
(
f
.
name
,
TESTFN
)
self
.
assert
True
(
not
f
.
isatty
())
self
.
assert
False
(
f
.
isatty
())
self
.
assert
True
(
not
f
.
closed
)
self
.
assert
False
(
f
.
closed
)
if
hasattr
(
f
,
"readinto"
):
if
hasattr
(
f
,
"readinto"
):
self
.
assertRaises
((
OSError
,
TypeError
),
f
.
readinto
,
""
)
self
.
assertRaises
((
OSError
,
TypeError
),
f
.
readinto
,
""
)
...
...
Lib/test/test_fileio.py
Dosyayı görüntüle @
0dcd80a6
...
@@ -113,15 +113,15 @@ class AutoFileTests(unittest.TestCase):
...
@@ -113,15 +113,15 @@ class AutoFileTests(unittest.TestCase):
def
testErrors
(
self
):
def
testErrors
(
self
):
f
=
self
.
f
f
=
self
.
f
self
.
assert
True
(
not
f
.
isatty
())
self
.
assert
False
(
f
.
isatty
())
self
.
assert
True
(
not
f
.
closed
)
self
.
assert
False
(
f
.
closed
)
#self.assertEqual(f.name, TESTFN)
#self.assertEqual(f.name, TESTFN)
self
.
assertRaises
(
ValueError
,
f
.
read
,
10
)
# Open for reading
self
.
assertRaises
(
ValueError
,
f
.
read
,
10
)
# Open for reading
f
.
close
()
f
.
close
()
self
.
assertTrue
(
f
.
closed
)
self
.
assertTrue
(
f
.
closed
)
f
=
_FileIO
(
TESTFN
,
'r'
)
f
=
_FileIO
(
TESTFN
,
'r'
)
self
.
assertRaises
(
TypeError
,
f
.
readinto
,
""
)
self
.
assertRaises
(
TypeError
,
f
.
readinto
,
""
)
self
.
assert
True
(
not
f
.
closed
)
self
.
assert
False
(
f
.
closed
)
f
.
close
()
f
.
close
()
self
.
assertTrue
(
f
.
closed
)
self
.
assertTrue
(
f
.
closed
)
...
...
Lib/test/test_io.py
Dosyayı görüntüle @
0dcd80a6
...
@@ -453,7 +453,7 @@ class IOTest(unittest.TestCase):
...
@@ -453,7 +453,7 @@ class IOTest(unittest.TestCase):
with
self
.
open
(
support
.
TESTFN
,
"ab"
)
as
f
:
with
self
.
open
(
support
.
TESTFN
,
"ab"
)
as
f
:
self
.
assertEqual
(
f
.
tell
(),
3
)
self
.
assertEqual
(
f
.
tell
(),
3
)
with
self
.
open
(
support
.
TESTFN
,
"a"
)
as
f
:
with
self
.
open
(
support
.
TESTFN
,
"a"
)
as
f
:
self
.
assert
True
(
f
.
tell
()
>
0
)
self
.
assert
Greater
(
f
.
tell
(),
0
)
def
test_destructor
(
self
):
def
test_destructor
(
self
):
record
=
[]
record
=
[]
...
@@ -573,7 +573,7 @@ class IOTest(unittest.TestCase):
...
@@ -573,7 +573,7 @@ class IOTest(unittest.TestCase):
wr
=
weakref
.
ref
(
f
)
wr
=
weakref
.
ref
(
f
)
del
f
del
f
support
.
gc_collect
()
support
.
gc_collect
()
self
.
assert
True
(
wr
()
is
None
,
wr
)
self
.
assert
IsNone
(
wr
()
,
wr
)
with
self
.
open
(
support
.
TESTFN
,
"rb"
)
as
f
:
with
self
.
open
(
support
.
TESTFN
,
"rb"
)
as
f
:
self
.
assertEqual
(
f
.
read
(),
b
"abcxxx"
)
self
.
assertEqual
(
f
.
read
(),
b
"abcxxx"
)
...
@@ -717,7 +717,7 @@ class CIOTest(IOTest):
...
@@ -717,7 +717,7 @@ class CIOTest(IOTest):
del
MyIO
del
MyIO
del
obj
del
obj
support
.
gc_collect
()
support
.
gc_collect
()
self
.
assert
True
(
wr
()
is
None
,
wr
)
self
.
assert
IsNone
(
wr
()
,
wr
)
class
PyIOTest
(
IOTest
):
class
PyIOTest
(
IOTest
):
pass
pass
...
@@ -1164,7 +1164,7 @@ class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
...
@@ -1164,7 +1164,7 @@ class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
wr
=
weakref
.
ref
(
f
)
wr
=
weakref
.
ref
(
f
)
del
f
del
f
support
.
gc_collect
()
support
.
gc_collect
()
self
.
assert
True
(
wr
()
is
None
,
wr
)
self
.
assert
IsNone
(
wr
()
,
wr
)
def
test_args_error
(
self
):
def
test_args_error
(
self
):
# Issue #17275
# Issue #17275
...
@@ -1467,7 +1467,7 @@ class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
...
@@ -1467,7 +1467,7 @@ class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
wr
=
weakref
.
ref
(
f
)
wr
=
weakref
.
ref
(
f
)
del
f
del
f
support
.
gc_collect
()
support
.
gc_collect
()
self
.
assert
True
(
wr
()
is
None
,
wr
)
self
.
assert
IsNone
(
wr
()
,
wr
)
with
self
.
open
(
support
.
TESTFN
,
"rb"
)
as
f
:
with
self
.
open
(
support
.
TESTFN
,
"rb"
)
as
f
:
self
.
assertEqual
(
f
.
read
(),
b
"123xxx"
)
self
.
assertEqual
(
f
.
read
(),
b
"123xxx"
)
...
@@ -2199,7 +2199,7 @@ class TextIOWrapperTest(unittest.TestCase):
...
@@ -2199,7 +2199,7 @@ class TextIOWrapperTest(unittest.TestCase):
t
=
self
.
TextIOWrapper
(
b
,
encoding
=
"utf-8"
)
t
=
self
.
TextIOWrapper
(
b
,
encoding
=
"utf-8"
)
self
.
assertEqual
(
t
.
encoding
,
"utf-8"
)
self
.
assertEqual
(
t
.
encoding
,
"utf-8"
)
t
=
self
.
TextIOWrapper
(
b
)
t
=
self
.
TextIOWrapper
(
b
)
self
.
assert
True
(
t
.
encoding
is
not
None
)
self
.
assert
IsNotNone
(
t
.
encoding
)
codecs
.
lookup
(
t
.
encoding
)
codecs
.
lookup
(
t
.
encoding
)
def
test_encoding_errors_reading
(
self
):
def
test_encoding_errors_reading
(
self
):
...
@@ -2958,7 +2958,7 @@ class CTextIOWrapperTest(TextIOWrapperTest):
...
@@ -2958,7 +2958,7 @@ class CTextIOWrapperTest(TextIOWrapperTest):
wr
=
weakref
.
ref
(
t
)
wr
=
weakref
.
ref
(
t
)
del
t
del
t
support
.
gc_collect
()
support
.
gc_collect
()
self
.
assert
True
(
wr
()
is
None
,
wr
)
self
.
assert
IsNone
(
wr
()
,
wr
)
with
self
.
open
(
support
.
TESTFN
,
"rb"
)
as
f
:
with
self
.
open
(
support
.
TESTFN
,
"rb"
)
as
f
:
self
.
assertEqual
(
f
.
read
(),
b
"456def"
)
self
.
assertEqual
(
f
.
read
(),
b
"456def"
)
...
@@ -3106,7 +3106,7 @@ class MiscIOTest(unittest.TestCase):
...
@@ -3106,7 +3106,7 @@ class MiscIOTest(unittest.TestCase):
def
test___all__
(
self
):
def
test___all__
(
self
):
for
name
in
self
.
io
.
__all__
:
for
name
in
self
.
io
.
__all__
:
obj
=
getattr
(
self
.
io
,
name
,
None
)
obj
=
getattr
(
self
.
io
,
name
,
None
)
self
.
assert
True
(
obj
is
not
None
,
name
)
self
.
assert
IsNotNone
(
obj
,
name
)
if
name
==
"open"
:
if
name
==
"open"
:
continue
continue
elif
"error"
in
name
.
lower
()
or
name
==
"UnsupportedOperation"
:
elif
"error"
in
name
.
lower
()
or
name
==
"UnsupportedOperation"
:
...
@@ -3196,7 +3196,7 @@ class MiscIOTest(unittest.TestCase):
...
@@ -3196,7 +3196,7 @@ class MiscIOTest(unittest.TestCase):
wr
=
weakref
.
ref
(
c
)
wr
=
weakref
.
ref
(
c
)
del
c
,
b
del
c
,
b
support
.
gc_collect
()
support
.
gc_collect
()
self
.
assert
True
(
wr
()
is
None
,
wr
)
self
.
assert
IsNone
(
wr
()
,
wr
)
def
test_abcs
(
self
):
def
test_abcs
(
self
):
# Test the visible base classes are ABCs.
# Test the visible base classes are ABCs.
...
@@ -3348,7 +3348,7 @@ class MiscIOTest(unittest.TestCase):
...
@@ -3348,7 +3348,7 @@ class MiscIOTest(unittest.TestCase):
received
+=
iter
(
rf
.
read
,
None
)
received
+=
iter
(
rf
.
read
,
None
)
sent
,
received
=
b
''
.
join
(
sent
),
b
''
.
join
(
received
)
sent
,
received
=
b
''
.
join
(
sent
),
b
''
.
join
(
received
)
self
.
assert
True
(
sent
==
received
)
self
.
assert
Equal
(
sent
,
received
)
self
.
assertTrue
(
wf
.
closed
)
self
.
assertTrue
(
wf
.
closed
)
self
.
assertTrue
(
rf
.
closed
)
self
.
assertTrue
(
rf
.
closed
)
...
...
Lib/test/test_memoryio.py
Dosyayı görüntüle @
0dcd80a6
...
@@ -693,7 +693,8 @@ class CBytesIOTest(PyBytesIOTest):
...
@@ -693,7 +693,8 @@ class CBytesIOTest(PyBytesIOTest):
self
.
assertEqual
(
len
(
state
),
3
)
self
.
assertEqual
(
len
(
state
),
3
)
bytearray
(
state
[
0
])
# Check if state[0] supports the buffer interface.
bytearray
(
state
[
0
])
# Check if state[0] supports the buffer interface.
self
.
assertIsInstance
(
state
[
1
],
int
)
self
.
assertIsInstance
(
state
[
1
],
int
)
self
.
assertTrue
(
isinstance
(
state
[
2
],
dict
)
or
state
[
2
]
is
None
)
if
state
[
2
]
is
not
None
:
self
.
assertIsInstance
(
state
[
2
],
dict
)
memio
.
close
()
memio
.
close
()
self
.
assertRaises
(
ValueError
,
memio
.
__getstate__
)
self
.
assertRaises
(
ValueError
,
memio
.
__getstate__
)
...
@@ -749,7 +750,8 @@ class CStringIOTest(PyStringIOTest):
...
@@ -749,7 +750,8 @@ class CStringIOTest(PyStringIOTest):
self
.
assertIsInstance
(
state
[
0
],
str
)
self
.
assertIsInstance
(
state
[
0
],
str
)
self
.
assertIsInstance
(
state
[
1
],
str
)
self
.
assertIsInstance
(
state
[
1
],
str
)
self
.
assertIsInstance
(
state
[
2
],
int
)
self
.
assertIsInstance
(
state
[
2
],
int
)
self
.
assertTrue
(
isinstance
(
state
[
3
],
dict
)
or
state
[
3
]
is
None
)
if
state
[
3
]
is
not
None
:
self
.
assertIsInstance
(
state
[
3
],
dict
)
memio
.
close
()
memio
.
close
()
self
.
assertRaises
(
ValueError
,
memio
.
__getstate__
)
self
.
assertRaises
(
ValueError
,
memio
.
__getstate__
)
...
...
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