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
4e72cceb
Kaydet (Commit)
4e72cceb
authored
Nis 14, 2015
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
issue9859: Document test.support.detect_api_mismatch() and simplify its test.
üst
1bef9075
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
31 deletions
+30
-31
test.rst
Doc/library/test.rst
+9
-0
__init__.py
Lib/test/support/__init__.py
+1
-1
test_support.py
Lib/test/test_support.py
+20
-30
No files found.
Doc/library/test.rst
Dosyayı görüntüle @
4e72cceb
...
...
@@ -568,6 +568,15 @@ The :mod:`test.support` module defines the following functions:
def load_tests(*args):
return load_package_tests(os.path.dirname(__file__), *args)
.. function:: detect_api_mismatch(ref_api, other_api, *, ignore=()):
Returns the set of attributes, functions or methods of `ref_api` not
found on `other_api`, except for a defined list of items to be
ignored in this check specified in `ignore`.
By default this skips private attributes beginning with '_' but
includes all magic methods, i.e. those starting and ending in '__'.
The :mod:`test.support` module defines the following classes:
...
...
Lib/test/support/__init__.py
Dosyayı görüntüle @
4e72cceb
...
...
@@ -2184,7 +2184,7 @@ def fs_is_case_insensitive(directory):
return
False
def
detect_api_mismatch
(
ref_api
,
other_api
,
*
,
ignore
=
None
):
def
detect_api_mismatch
(
ref_api
,
other_api
,
*
,
ignore
=
()
):
"""Returns the set of items in ref_api not in other_api, except for a
defined list of items to be ignored in this check.
...
...
Lib/test/test_support.py
Dosyayı görüntüle @
4e72cceb
...
...
@@ -280,46 +280,36 @@ class TestSupport(unittest.TestCase):
self
.
assertEqual
(
D
[
"item"
],
5
)
self
.
assertEqual
(
D
[
"item"
],
1
)
class
RefClass
:
attribute1
=
None
attribute2
=
None
_hidden_attribute1
=
None
__magic_1__
=
None
class
OtherClass
:
attribute2
=
None
attribute3
=
None
__magic_1__
=
None
__magic_2__
=
None
def
test_detect_api_mismatch
(
self
):
class
RefClass
:
attribute1
=
None
attribute2
=
None
_hidden_attribute1
=
None
__magic_1__
=
None
class
OtherClass
:
attribute2
=
None
attribute3
=
None
__magic_1__
=
None
__magic_2__
=
None
missing_items
=
support
.
detect_api_mismatch
(
RefClass
,
OtherClass
)
missing_items
=
support
.
detect_api_mismatch
(
self
.
RefClass
,
self
.
OtherClass
)
self
.
assertEqual
({
'attribute1'
},
missing_items
)
missing_items
=
support
.
detect_api_mismatch
(
OtherClass
,
RefClass
)
missing_items
=
support
.
detect_api_mismatch
(
self
.
OtherClass
,
self
.
RefClass
)
self
.
assertEqual
({
'attribute3'
,
'__magic_2__'
},
missing_items
)
def
test_detect_api_mismatch__ignore
(
self
):
class
RefClass
:
attribute1
=
None
attribute2
=
None
_hidden_attribute1
=
None
__magic_1__
=
None
class
OtherClass
:
attribute2
=
None
attribute3
=
None
__magic_1__
=
None
__magic_2__
=
None
ignore
=
[
'attribute1'
,
'attribute3'
,
'__magic_2__'
,
'not_in_either'
]
missing_items
=
support
.
detect_api_mismatch
(
RefClass
,
OtherClass
,
ignore
=
ignore
)
missing_items
=
support
.
detect_api_mismatch
(
self
.
RefClass
,
self
.
OtherClass
,
ignore
=
ignore
)
self
.
assertEqual
(
set
(),
missing_items
)
missing_items
=
support
.
detect_api_mismatch
(
OtherClass
,
RefClass
,
ignore
=
ignore
)
missing_items
=
support
.
detect_api_mismatch
(
self
.
OtherClass
,
self
.
RefClass
,
ignore
=
ignore
)
self
.
assertEqual
(
set
(),
missing_items
)
# XXX -follows a list of untested API
...
...
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