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
edeca92c
Kaydet (Commit)
edeca92c
authored
Ara 01, 2018
tarafından
Xtreak
Kaydeden (comit)
Victor Stinner
Ara 01, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31177: Skip deleted attributes while calling reset_mock (GH-9302)
üst
98905204
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
mock.py
Lib/unittest/mock.py
+1
-1
testmock.py
Lib/unittest/test/testmock/testmock.py
+10
-0
2018-09-14-10-38-18.bpo-31177.Sv91TN.rst
...S.d/next/Library/2018-09-14-10-38-18.bpo-31177.Sv91TN.rst
+2
-0
No files found.
Lib/unittest/mock.py
Dosyayı görüntüle @
edeca92c
...
...
@@ -542,7 +542,7 @@ class NonCallableMock(Base):
self
.
_mock_side_effect
=
None
for
child
in
self
.
_mock_children
.
values
():
if
isinstance
(
child
,
_SpecState
):
if
isinstance
(
child
,
_SpecState
)
or
child
is
_deleted
:
continue
child
.
reset_mock
(
visited
)
...
...
Lib/unittest/test/testmock/testmock.py
Dosyayı görüntüle @
edeca92c
...
...
@@ -1596,6 +1596,16 @@ class MockTest(unittest.TestCase):
self
.
assertRaises
(
AttributeError
,
getattr
,
mock
,
'f'
)
def
test_reset_mock_does_not_raise_on_attr_deletion
(
self
):
# bpo-31177: reset_mock should not raise AttributeError when attributes
# were deleted in a mock instance
mock
=
Mock
()
mock
.
child
=
True
del
mock
.
child
mock
.
reset_mock
()
self
.
assertFalse
(
hasattr
(
mock
,
'child'
))
def
test_class_assignable
(
self
):
for
mock
in
Mock
(),
MagicMock
():
self
.
assertNotIsInstance
(
mock
,
int
)
...
...
Misc/NEWS.d/next/Library/2018-09-14-10-38-18.bpo-31177.Sv91TN.rst
0 → 100644
Dosyayı görüntüle @
edeca92c
Fix bug that prevented using :meth:`reset_mock <unittest.mock.Mock.reset_mock>`
on mock instances with deleted attributes
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