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
324c5d8c
Kaydet (Commit)
324c5d8c
authored
Şub 23, 2017
tarafından
Arne de Laat
Kaydeden (comit)
Victor Stinner
Şub 23, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-28911: Clarify the behaviour of assert_called_once_with. (#251)
üst
d7e64337
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
unittest.mock.rst
Doc/library/unittest.mock.rst
+6
-5
mock.py
Lib/unittest/mock.py
+2
-2
No files found.
Doc/library/unittest.mock.rst
Dosyayı görüntüle @
324c5d8c
...
...
@@ -303,14 +303,14 @@ the *new_callable* argument to :func:`patch`.
.. method:: assert_called_once_with(*args, **kwargs)
Assert that the mock was called exactly once and
with the specified
arguments.
Assert that the mock was called exactly once and
that that call was
with the specified
arguments.
>>> mock = Mock(return_value=None)
>>> mock('foo', bar='baz')
>>> mock.assert_called_once_with('foo', bar='baz')
>>> mock('
foo', bar='baz
')
>>> mock.assert_called_once_with('
foo', bar='baz
')
>>> mock('
other', bar='values
')
>>> mock.assert_called_once_with('
other', bar='values
')
Traceback (most recent call last):
...
AssertionError: Expected 'mock' to be called once. Called 2 times.
...
...
@@ -322,7 +322,8 @@ the *new_callable* argument to :func:`patch`.
The assert passes if the mock has *ever* been called, unlike
:meth:`assert_called_with` and :meth:`assert_called_once_with` that
only pass if the call is the most recent one.
only pass if the call is the most recent one, and in the case of
:meth:`assert_called_once_with` it must also be the only call.
>>> mock = Mock(return_value=None)
>>> mock(1, 2, arg='thing')
...
...
Lib/unittest/mock.py
Dosyayı görüntüle @
324c5d8c
...
...
@@ -811,8 +811,8 @@ class NonCallableMock(Base):
def
assert_called_once_with
(
_mock_self
,
*
args
,
**
kwargs
):
"""assert that the mock was called exactly once and
with the specified
arguments."""
"""assert that the mock was called exactly once and
that that call was
with the specified
arguments."""
self
=
_mock_self
if
not
self
.
call_count
==
1
:
msg
=
(
"Expected '
%
s' to be called once. Called
%
s times."
%
...
...
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