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
0682a0c0
Kaydet (Commit)
0682a0c0
authored
Nis 13, 2012
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Minor docstring / docs corrections for unittest.mock
üst
656319e5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
unittest.mock-examples.rst
Doc/library/unittest.mock-examples.rst
+1
-1
unittest.mock.rst
Doc/library/unittest.mock.rst
+4
-4
mock.py
Lib/unittest/mock.py
+6
-6
No files found.
Doc/library/unittest.mock-examples.rst
Dosyayı görüntüle @
0682a0c0
...
@@ -99,7 +99,7 @@ by looking at the return value of the mocked class.
...
@@ -99,7 +99,7 @@ by looking at the return value of the mocked class.
In the example below we have a function `some_function` that instantiates `Foo`
In the example below we have a function `some_function` that instantiates `Foo`
and calls a method on it. The call to `patch` replaces the class `Foo` with a
and calls a method on it. The call to `patch` replaces the class `Foo` with a
mock. The `Foo` instance is the result of calling the mock, so it is configured
mock. The `Foo` instance is the result of calling the mock, so it is configured
by modify the mock :attr:`~Mock.return_value`.
by modify
ing
the mock :attr:`~Mock.return_value`.
>>> def some_function():
>>> def some_function():
... instance = module.Foo()
... instance = module.Foo()
...
...
Doc/library/unittest.mock.rst
Dosyayı görüntüle @
0682a0c0
...
@@ -236,10 +236,10 @@ the `new_callable` argument to `patch`.
...
@@ -236,10 +236,10 @@ the `new_callable` argument to `patch`.
* `wraps`: Item for the mock object to wrap. If `wraps` is not None then
* `wraps`: Item for the mock object to wrap. If `wraps` is not None then
calling the Mock will pass the call through to the wrapped object
calling the Mock will pass the call through to the wrapped object
(returning the real result
and ignoring `return_value`). Attribute access
(returning the real result
). Attribute access on the mock will return a
on the mock will return a Mock object that wraps the corresponding
Mock object that wraps the corresponding attribute of the wrapped
attribute of the wrapped object (so attempting to access an attribute
object (so attempting to access an attribute that doesn't exist will
that doesn't exist will
raise an `AttributeError`).
raise an `AttributeError`).
If the mock has an explicit `return_value` set then calls are not passed
If the mock has an explicit `return_value` set then calls are not passed
to the wrapped object and the `return_value` is returned instead.
to the wrapped object and the `return_value` is returned instead.
...
...
Lib/unittest/mock.py
Dosyayı görüntüle @
0682a0c0
...
@@ -941,12 +941,12 @@ class Mock(CallableMixin, NonCallableMock):
...
@@ -941,12 +941,12 @@ class Mock(CallableMixin, NonCallableMock):
this is a new Mock (created on first access). See the
this is a new Mock (created on first access). See the
`return_value` attribute.
`return_value` attribute.
* `wraps`: Item for the mock object to wrap. If `wraps` is not None
* `wraps`: Item for the mock object to wrap. If `wraps` is not None
then
then
calling the Mock will pass the call through to the wrapped object
calling the Mock will pass the call through to the wrapped object
(returning the real result
and ignoring `return_value`). Attribute
(returning the real result
). Attribute access on the mock will return a
access on the mock will return a Mock object that wraps the corresponding
Mock object that wraps the corresponding attribute of the wrapped object
attribute of the wrapped object (so attempting to access an attribute that
(so attempting to access an attribute that doesn't exist will raise an
doesn't exist will raise an
`AttributeError`).
`AttributeError`).
If the mock has an explicit `return_value` set then calls are not passed
If the mock has an explicit `return_value` set then calls are not passed
to the wrapped object and the `return_value` is returned instead.
to the wrapped object and the `return_value` is returned instead.
...
...
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