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
c85dd85f
Kaydet (Commit)
c85dd85f
authored
May 16, 2016
tarafından
Robert Collins
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #26807: mock_open 'files' no longer error on readline at end of file.
Patch from Yolanda Robla.
üst
2b6c032e
9549a3e3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
0 deletions
+18
-0
mock.py
Lib/unittest/mock.py
+2
-0
testmock.py
Lib/unittest/test/testmock/testmock.py
+12
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/unittest/mock.py
Dosyayı görüntüle @
c85dd85f
...
@@ -2341,6 +2341,8 @@ def mock_open(mock=None, read_data=''):
...
@@ -2341,6 +2341,8 @@ def mock_open(mock=None, read_data=''):
yield
handle
.
readline
.
return_value
yield
handle
.
readline
.
return_value
for
line
in
_state
[
0
]:
for
line
in
_state
[
0
]:
yield
line
yield
line
while
True
:
yield
type
(
read_data
)()
global
file_spec
global
file_spec
...
...
Lib/unittest/test/testmock/testmock.py
Dosyayı görüntüle @
c85dd85f
...
@@ -1440,6 +1440,18 @@ class MockTest(unittest.TestCase):
...
@@ -1440,6 +1440,18 @@ class MockTest(unittest.TestCase):
self
.
assertEqual
(
'abc'
,
first
)
self
.
assertEqual
(
'abc'
,
first
)
self
.
assertEqual
(
'abc'
,
second
)
self
.
assertEqual
(
'abc'
,
second
)
def
test_mock_open_after_eof
(
self
):
# read, readline and readlines should work after end of file.
_open
=
mock
.
mock_open
(
read_data
=
'foo'
)
h
=
_open
(
'bar'
)
h
.
read
()
self
.
assertEqual
(
''
,
h
.
read
())
self
.
assertEqual
(
''
,
h
.
read
())
self
.
assertEqual
(
''
,
h
.
readline
())
self
.
assertEqual
(
''
,
h
.
readline
())
self
.
assertEqual
([],
h
.
readlines
())
self
.
assertEqual
([],
h
.
readlines
())
def
test_mock_parents
(
self
):
def
test_mock_parents
(
self
):
for
Klass
in
Mock
,
MagicMock
:
for
Klass
in
Mock
,
MagicMock
:
m
=
Klass
()
m
=
Klass
()
...
...
Misc/ACKS
Dosyayı görüntüle @
c85dd85f
...
@@ -1231,6 +1231,7 @@ Ben Roberts
...
@@ -1231,6 +1231,7 @@ Ben Roberts
Mark Roberts
Mark Roberts
Andy Robinson
Andy Robinson
Jim Robinson
Jim Robinson
Yolanda Robla
Daniel Rocco
Daniel Rocco
Mark Roddy
Mark Roddy
Kevin Rodgers
Kevin Rodgers
...
...
Misc/NEWS
Dosyayı görüntüle @
c85dd85f
...
@@ -290,6 +290,9 @@ Library
...
@@ -290,6 +290,9 @@ Library
-
Issue
#
22274
:
In
the
subprocess
module
,
allow
stderr
to
be
redirected
to
-
Issue
#
22274
:
In
the
subprocess
module
,
allow
stderr
to
be
redirected
to
stdout
even
when
stdout
is
not
redirected
.
Patch
by
Akira
Li
.
stdout
even
when
stdout
is
not
redirected
.
Patch
by
Akira
Li
.
-
Issue
#
26807
:
mock_open
'files'
no
longer
error
on
readline
at
end
of
file
.
Patch
from
Yolanda
Robla
.
-
Issue
#
25745
:
Fixed
leaking
a
userptr
in
curses
panel
destructor
.
-
Issue
#
25745
:
Fixed
leaking
a
userptr
in
curses
panel
destructor
.
-
Issue
#
26977
:
Removed
unnecessary
,
and
ignored
,
call
to
sum
of
squares
helper
-
Issue
#
26977
:
Removed
unnecessary
,
and
ignored
,
call
to
sum
of
squares
helper
...
...
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