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
a67a79da
Kaydet (Commit)
a67a79da
authored
Ock 21, 2014
tarafından
Terry Jan Reedy
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge with 3.3
üst
b6457249
30ffe7eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
unittest.mock-examples.rst
Doc/library/unittest.mock-examples.rst
+2
-2
No files found.
Doc/library/unittest.mock-examples.rst
Dosyayı görüntüle @
a67a79da
...
...
@@ -476,7 +476,7 @@ the `backend` attribute on a `Something` instance. In this particular case
we are only interested in the return value from the final call to
`start_call` so we don't have much configuration to do. Let's assume the
object it returns is 'file-like', so we'll ensure that our response object
uses the builtin `
file
` as its `spec`.
uses the builtin `
open
` as its `spec`.
To do this we create a mock instance as our mock backend and create a mock
response object for it. To set the response as the return value for that final
...
...
@@ -488,7 +488,7 @@ We can do that in a slightly nicer way using the :meth:`~Mock.configure_mock`
method to directly set the return value for us:
>>> something = Something()
>>> mock_response = Mock(spec=
file
)
>>> mock_response = Mock(spec=
open
)
>>> mock_backend = Mock()
>>> config = {'get_endpoint.return_value.create_call.return_value.start_call.return_value': mock_response}
>>> mock_backend.configure_mock(**config)
...
...
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