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
f85af035
Kaydet (Commit)
f85af035
authored
Tem 09, 2018
tarafından
Andrés Delfino
Kaydeden (comit)
Mariatta
Tem 09, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix margin in sentinel and mock_open (GH-8188)
üst
bc9aa813
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
unittest.mock.rst
Doc/library/unittest.mock.rst
+21
-21
No files found.
Doc/library/unittest.mock.rst
Dosyayı görüntüle @
f85af035
...
...
@@ -1825,12 +1825,12 @@ sentinel
.. data:: sentinel
The ``sentinel`` object provides a convenient way of providing unique
objects for your tests.
The ``sentinel`` object provides a convenient way of providing unique
objects for your tests.
Attributes are created on demand when you access them by name. Accessing
the same attribute will always return the same object. The objects
returned have a sensible repr so that test failure messages are readable.
Attributes are created on demand when you access them by name. Accessing
the same attribute will always return the same object. The objects
returned have a sensible repr so that test failure messages are readable.
.. versionchanged:: 3.7
The ``sentinel`` attributes now preserve their identity when they are
...
...
@@ -2070,22 +2070,22 @@ mock_open
.. function:: mock_open(mock=None, read_data=None)
A helper function to create a mock to replace the use of :func:`open`. It works
for :func:`open` called directly or used as a context manager.
The *mock* argument is the mock object to configure. If ``None`` (the
default) then a :class:`MagicMock` will be created for you, with the API limited
to methods or attributes available on standard file handles.
*read_data* is a string for the :meth:`~io.IOBase.read`,
:meth:`~io.IOBase.readline`, and :meth:`~io.IOBase.readlines` methods
of the file handle to return. Calls to those methods will take data from
*read_data* until it is depleted. The mock of these methods is pretty
simplistic: every time the *mock* is called, the *read_data* is rewound to
the start. If you need more control over the data that you are feeding to
the tested code you will need to customize this mock for yourself. When that
is insufficient, one of the in-memory filesystem packages on `PyPI
<https://pypi.org>`_ can offer a realistic filesystem for testing.
A helper function to create a mock to replace the use of :func:`open`. It works
for :func:`open` called directly or used as a context manager.
The *mock* argument is the mock object to configure. If ``None`` (the
default) then a :class:`MagicMock` will be created for you, with the API limited
to methods or attributes available on standard file handles.
*read_data* is a string for the :meth:`~io.IOBase.read`,
:meth:`~io.IOBase.readline`, and :meth:`~io.IOBase.readlines` methods
of the file handle to return. Calls to those methods will take data from
*read_data* until it is depleted. The mock of these methods is pretty
simplistic: every time the *mock* is called, the *read_data* is rewound to
the start. If you need more control over the data that you are feeding to
the tested code you will need to customize this mock for yourself. When that
is insufficient, one of the in-memory filesystem packages on `PyPI
<https://pypi.org>`_ can offer a realistic filesystem for testing.
.. versionchanged:: 3.4
Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support.
...
...
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