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
a37b958d
Kaydet (Commit)
a37b958d
authored
Eyl 16, 2014
tarafından
Kushal Das
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Closes #21270 : We now override tuple methods in mock.call objects.
üst
a0f33759
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
mock.py
Lib/unittest/mock.py
+6
-0
testmock.py
Lib/unittest/test/testmock/testmock.py
+10
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/unittest/mock.py
Dosyayı görüntüle @
a37b958d
...
...
@@ -2035,6 +2035,12 @@ class _Call(tuple):
return
_Call
(
name
=
name
,
parent
=
self
,
from_kall
=
False
)
def
count
(
self
,
*
args
,
**
kwargs
):
return
self
.
__getattr__
(
'count'
)(
*
args
,
**
kwargs
)
def
index
(
self
,
*
args
,
**
kwargs
):
return
self
.
__getattr__
(
'index'
)(
*
args
,
**
kwargs
)
def
__repr__
(
self
):
if
not
self
.
from_kall
:
name
=
self
.
name
or
'call'
...
...
Lib/unittest/test/testmock/testmock.py
Dosyayı görüntüle @
a37b958d
...
...
@@ -1213,6 +1213,16 @@ class MockTest(unittest.TestCase):
text
=
"call(daddy='hero', name='hello')"
self
.
assertEqual
(
repr
(
m
.
hello
.
call_args
),
text
)
#Issue21270 overrides tuple methods for mock.call objects
def
test_override_tuple_methods
(
self
):
c
=
call
.
count
()
i
=
call
.
index
(
132
,
'hello'
)
m
=
Mock
()
m
.
count
()
m
.
index
(
132
,
"hello"
)
self
.
assertEqual
(
m
.
method_calls
[
0
],
c
)
self
.
assertEqual
(
m
.
method_calls
[
1
],
i
)
def
test_mock_add_spec
(
self
):
class
_One
(
object
):
one
=
1
...
...
Misc/NEWS
Dosyayı görüntüle @
a37b958d
...
...
@@ -157,6 +157,9 @@ Library
-
Issue
#
12410
:
imaplib
.
IMAP4
now
supports
the
context
management
protocol
.
Original
patch
by
Tarek
Ziad
é
.
-
Issue
#
21270
:
We
now
override
tuple
methods
in
mock
.
call
objects
so
that
they
can
be
used
as
normal
call
attributes
.
-
Issue
#
16662
:
load_tests
()
is
now
unconditionally
run
when
it
is
present
in
a
package
's __init__.py. TestLoader.loadTestsFromModule() still accepts
use_load_tests, but it is deprecated and ignored. A new keyword-only
...
...
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