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
fd628cf5
Kaydet (Commit)
fd628cf5
authored
Ock 23, 2019
tarafından
Jason Fried
Kaydeden (comit)
Łukasz Langa
Ock 23, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-35767: Fix unittest.loader to allow partials as test_functions (#11600)
üst
f6243ac1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
loader.py
Lib/unittest/loader.py
+3
-1
test_loader.py
Lib/unittest/test/test_loader.py
+16
-0
No files found.
Lib/unittest/loader.py
Dosyayı görüntüle @
fd628cf5
...
...
@@ -229,7 +229,9 @@ class TestLoader(object):
testFunc
=
getattr
(
testCaseClass
,
attrname
)
if
not
callable
(
testFunc
):
return
False
fullName
=
'
%
s.
%
s'
%
(
testCaseClass
.
__module__
,
testFunc
.
__qualname__
)
fullName
=
f
'
%
s.
%
s.
%
s'
%
(
testCaseClass
.
__module__
,
testCaseClass
.
__qualname__
,
attrname
)
return
self
.
testNamePatterns
is
None
or
\
any
(
fnmatchcase
(
fullName
,
pattern
)
for
pattern
in
self
.
testNamePatterns
)
testFnNames
=
list
(
filter
(
shouldIncludeMethod
,
dir
(
testCaseClass
)))
...
...
Lib/unittest/test/test_loader.py
Dosyayı görüntüle @
fd628cf5
import
functools
import
sys
import
types
import
warnings
...
...
@@ -1575,5 +1576,20 @@ class Test_TestLoader(unittest.TestCase):
self
.
assertIs
(
loader
.
suiteClass
,
unittest
.
TestSuite
)
def
test_partial_functions
(
self
):
def
noop
(
arg
):
pass
class
Foo
(
unittest
.
TestCase
):
pass
setattr
(
Foo
,
'test_partial'
,
functools
.
partial
(
noop
,
None
))
loader
=
unittest
.
TestLoader
()
test_names
=
[
'test_partial'
]
self
.
assertEqual
(
loader
.
getTestCaseNames
(
Foo
),
test_names
)
if
__name__
==
"__main__"
:
unittest
.
main
()
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