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
22194505
Kaydet (Commit)
22194505
authored
Tem 19, 2016
tarafından
Martin Panter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27528: Document and test warning messages must match at beginning
üst
95f53c13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
warnings.rst
Doc/library/warnings.rst
+4
-3
__init__.py
Lib/test/test_warnings/__init__.py
+12
-0
No files found.
Doc/library/warnings.rst
Dosyayı görüntüle @
22194505
...
...
@@ -141,14 +141,15 @@ the disposition of the match. Each entry is a tuple of the form (*action*,
| | warnings, regardless of location |
+---------------+----------------------------------------------+
* *message* is a string containing a regular expression that the warning message
must match (the match is compiled to always be case-insensitive).
* *message* is a string containing a regular expression that the start of
the warning message must match. The expression is compiled to always be
case-insensitive.
* *category* is a class (a subclass of :exc:`Warning`) of which the warning
category must be a subclass in order to match.
* *module* is a string containing a regular expression that the module name must
match
(the match is compiled to be case-sensitive)
.
match
. The expression is compiled to be case-sensitive
.
* *lineno* is an integer that the line number where the warning occurred must
match, or ``0`` to match all line numbers.
...
...
Lib/test/test_warnings/__init__.py
Dosyayı görüntüle @
22194505
...
...
@@ -261,6 +261,18 @@ class FilterTests(BaseTest):
self
.
assertEqual
(
str
(
w
[
-
1
]
.
message
),
text
)
self
.
assertTrue
(
w
[
-
1
]
.
category
is
UserWarning
)
def
test_message_matching
(
self
):
with
original_warnings
.
catch_warnings
(
record
=
True
,
module
=
self
.
module
)
as
w
:
self
.
module
.
simplefilter
(
"ignore"
,
UserWarning
)
self
.
module
.
filterwarnings
(
"error"
,
"match"
,
UserWarning
)
self
.
assertRaises
(
UserWarning
,
self
.
module
.
warn
,
"match"
)
self
.
assertRaises
(
UserWarning
,
self
.
module
.
warn
,
"match prefix"
)
self
.
module
.
warn
(
"suffix match"
)
self
.
assertEqual
(
w
,
[])
self
.
module
.
warn
(
"something completely different"
)
self
.
assertEqual
(
w
,
[])
def
test_mutate_filter_list
(
self
):
class
X
:
def
match
(
self
,
a
):
...
...
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