hyb
2025-11-04 668edf874b4f77214a8ff4513e60e3c1a973f532
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Ë
oñúh¥ ãó—ddlmZddlmZmZddlZddlZddlZddlm    Z    m
Z
m Z ddl Z ddl mZe    rddlmZmZeeddddf                                            dd    „«Zdd
„Z                                        dd „Z                        dd „Z                        dd „Z                dd„Zy)é)Ú annotations)ÚcontextmanagerÚ nullcontextN)Ú TYPE_CHECKINGÚLiteralÚcast)ÚPY311)Ú    GeneratorÚSequenceÚalwaysTc    #ó„K—d}tjd¬«5}tj|«    |–—|r&ttt
|«}t ||||¬«|rt||¬«    ddd«y#|r&ttt
|«}t ||||¬«|rt||¬«wwxYw#1swYyxYw­w)a$    
    Context manager for running code expected to either raise a specific warning,
    multiple specific warnings, or not raise any warnings. Verifies that the code
    raises the expected warning(s), and that it does not raise any other unexpected
    warnings. It is basically a wrapper around ``warnings.catch_warnings``.
 
    Parameters
    ----------
    expected_warning : {Warning, False, tuple[Warning, ...], None}, default Warning
        The type of Exception raised. ``exception.Warning`` is the base
        class for all warnings. To raise multiple types of exceptions,
        pass them as a tuple. To check that no warning is returned,
        specify ``False`` or ``None``.
    filter_level : str or None, default "always"
        Specifies whether warnings are ignored, displayed, or turned
        into errors.
        Valid values are:
 
        * "error" - turns matching warnings into exceptions
        * "ignore" - discard the warning
        * "always" - always emit a warning
        * "default" - print the warning the first time it is generated
          from each location
        * "module" - print the warning the first time it is generated
          from each module
        * "once" - print the warning the first time it is generated
 
    check_stacklevel : bool, default True
        If True, displays the line that called the function containing
        the warning to show were the function is called. Otherwise, the
        line that implements the function is displayed.
    raise_on_extra_warnings : bool, default True
        Whether extra warnings not of the type `expected_warning` should
        cause the test to fail.
    match : str, optional
        Match warning message.
 
    Examples
    --------
    >>> import warnings
    >>> with assert_produces_warning():
    ...     warnings.warn(UserWarning())
    ...
    >>> with assert_produces_warning(False):
    ...     warnings.warn(RuntimeWarning())
    ...
    Traceback (most recent call last):
        ...
    AssertionError: Caused unexpected warning(s): ['RuntimeWarning'].
    >>> with assert_produces_warning(UserWarning):
    ...     warnings.warn(RuntimeWarning())
    Traceback (most recent call last):
        ...
    AssertionError: Did not see expected warning of class 'UserWarning'.
 
    ..warn:: This is *not* thread-safe.
    T)Úrecord)Úcaught_warningsÚexpected_warningÚmatchÚcheck_stacklevel)rrN)ÚwarningsÚcatch_warningsÚ simplefilterrÚtypeÚWarningÚ_assert_caught_expected_warningÚ _assert_caught_no_extra_warnings)rÚ filter_levelrÚraise_on_extra_warningsrÚ__tracebackhide__Úws       úLH:\Change_password\venv_build\Lib\site-packages\pandas/_testing/_warnings.pyÚassert_produces_warningrsÑèø€ðFÐä    ×     Ñ     ¨Ô    -ð°Ü×јlÔ+ð    ØŠGáÜ#'¬¬W© Ð7GÓ#HРÜ/Ø$%Ø%5ØØ%5õ    ñ 'Ü0Ø$%Ø%5ö÷ðøñ
 Ü#'¬¬W© Ð7GÓ#HРÜ/Ø$%Ø%5ØØ%5õ    ñ 'Ü0Ø$%Ø%5öð'ú÷ðüs2‚C›B4²A7¶8B4Á.    CÁ7:B1Â1B4Â4B=Â9Cc ó2—|r t|fi|¤ŽSt«S)zX
    Return a context manager that possibly checks a warning based on the condition
    )rr)ÚwarningÚ    conditionÚkwargss   rÚmaybe_produces_warningr$ss€ñÜ& wÑ9°&Ñ9Ð9ä‹}Ðócóœ—d}d}g}|D]r}t|j|«sŒd}|r t|«|€Œ,tj|t |j ««rd}ŒX|j|j «Œt|s!tdt|j«›«‚|r*|s'tdt|j«›d|›d|›«‚yy)zEAssert that there was the expected warning among the caught warnings.FTNz&Did not see expected warning of class zDid not see warning z  matching 'z$'. The emitted warning messages are ) Ú
issubclassÚcategoryÚ&_assert_raised_with_correct_stacklevelÚreÚsearchÚstrÚmessageÚappendÚAssertionErrorÚreprÚ__name__)rrrrÚ saw_warningÚmatched_messageÚunmatched_messagesÚactual_warnings        rrr}sò€ð€KØ€OØÐà)ò FˆÜ n×-Ñ-Ð/?Õ @؈KáÜ6°~ÔFàÑ Ü—9‘9˜U¤C¨×(>Ñ(>Ó$?Ô@Ø&*‘Oà&×-Ñ-¨n×.DÑ.DÕEð Fñ ÜØ4ÜÐ$×-Ñ-Ó.Ð/ð 1ó
ð    
ñ
 ‘_ÜØ"¤4Ð(8×(AÑ(AÓ#BÐ"CðDؘÐCØ!Ð"ð $ó
ð    
ð%€ur%có¼—g}|D]¼}t||«sŒ|jtk(r9dt|j«vrŒ;t d„t jD««rŒ\tr|jtk(rŒv|j|jj|j|j|jf«Œ¾|rtdt|«›«‚y)zFAssert that no extra warnings apart from the expected ones are caught.zunclosed <ssl.SSLSocketc3ó$K—|]}d|v–—Œ
y­w)Ú
matplotlibN©)Ú.0Úmods  rú    <genexpr>z3_assert_caught_no_extra_warnings.<locals>.<genexpr>·sèø€ÒB¨s| sÔ*ÑBùs‚zCaused unexpected warning(s): N)Ú_is_unexpected_warningr(ÚResourceWarningr,r-ÚanyÚsysÚmodulesr    ÚEncodingWarningr.r1ÚfilenameÚlinenor/r0)rrÚextra_warningsr5s    rrr¤sՀð €Nà)òˆÜ ! .Ð2BÕ Cà×&Ñ&¬/Ò9ð-´°N×4JÑ4JÓ0KÑKØôÑB´c·k±kÔBÔBØÝ˜×0Ñ0´OÒCðØ × !Ñ !à"×+Ñ+×4Ñ4Ø"×*Ñ*Ø"×+Ñ+Ø"×)Ñ)ð    õ ð%ñ6ÜÐ=¼dÀ>Ó>RÐ=SÐTÓUÐUðr%cóz—|r|syttt|«}tt    |j
|« «S)z1Check if the actual warning issued is unexpected.T)rrrÚboolr'r()r5rs  rr=r=Ës;€ñ
Ñ.ØÜœD¤™MÐ+;Ó<ÐÜ ”J˜~×6Ñ6Ð8HÓIÐIÓ JÐJr%có—tj«}td«D]}|j}Œ    tj|«}~d|j
›d|›d|j ›}|j
|k(sJ|«‚y#~wxYw)NézGWarning not set with correct stacklevel. File where warning is raised: z != z. Warning message: )ÚinspectÚ currentframeÚrangeÚf_backÚgetfilerCr-)r5ÚframeÚ_Úcaller_filenameÚmsgs     rr)r)Ösš€ô ×  Ñ  Ó "€EÜ 1‹XòˆØ— ‘ ‰ððÜ!Ÿ/™/¨%Ó0ˆð ð    )Ø)7×)@Ñ)@Ð(AÀØ Ð
Ð.¨~×/EÑ/EÐ.Fð    Hðð
× "Ñ " oÒ 5Ð:°sÓ:Ñ 5øñ ús ²A>Á>B) rú7type[Warning] | bool | tuple[type[Warning], ...] | NonerzALiteral['error', 'ignore', 'always', 'default', 'module', 'once']rrGrrGrú
str | NoneÚreturnz4Generator[list[warnings.WarningMessage], None, None])r!ú type[Warning]r"rG)
rú!Sequence[warnings.WarningMessage]rrVrrTrrGrUÚNone)rrWrrSrUrX)r5úwarnings.WarningMessagerrSrUrG)r5rYrUrX)Ú
__future__rÚ
contextlibrrrJr*r@ÚtypingrrrrÚ pandas.compatr    Úcollections.abcr
r rrr$rrr=r)r9r%rú<module>r_s4ðÝ"÷óÛ    Û
÷ñó
åá÷ð àPWð    Ø!Ø$(ØðUØMðUððUð
ð Uð "ð Uð ðUð:òUóðUópð$
à6ð$
ð$ð$
ð ð    $
ð
ð $
ð 
ó $
ðN$Và6ð$VðNð$Vð
ó    $VðNKØ+ðKàMðKð
óKð;Ø+ð;à    ô;r%