zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
U
P±dÔ-ã@s‚dZddlZddlZddlmZmZmZddddd    d
d gZd d„Z    ddd„Z
ddd„Z ddd„Z ddd    „Z dd
„Ze e dƒZdS)aÅ
Decorators for labeling and modifying behavior of test objects.
 
Decorators that merely return a modified version of the original
function object are straightforward. Decorators that return a new
function object need to use
::
 
  nose.tools.make_decorator(original_function)(decorator)
 
in returning the decorator, in order to preserve meta-data such as
function name, setup and teardown functions and so on - see
``nose.tools`` for more information.
 
éNé)ÚSkipTestÚ assert_warnsÚ HAS_REFCOUNTÚslowÚ    setastestÚskipifÚknownfailureifÚ
deprecatedÚ parametrizeÚ_needs_refcountcCstjdtddd|_|S)a¨
    .. deprecated:: 1.21
        This decorator is retained for compatibility with the nose testing framework, which is being phased out.
        Please use the nose2 or pytest frameworks instead.
 
    Label a test as 'slow'.
 
    The exact definition of a slow test is obviously both subjective and
    hardware-dependent, but in general any individual test that requires more
    than a second or two should be labeled as slow (the whole suite consists of
    thousands of tests, so even a second is significant).
 
    Parameters
    ----------
    t : callable
        The test to label as slow.
 
    Returns
    -------
    t : callable
        The decorated test `t`.
 
    Examples
    --------
    The `numpy.testing` module includes ``import decorators as dec``.
    A test can be decorated as slow like this::
 
      from numpy.testing import *
 
      @dec.slow
      def test_big(self):
          print('Big, slow test')
 
    úŽthe np.testing.dec decorators are included for nose support, and are deprecated since NumPy v1.21. Use the nose2 or pytest frameworks instead.é©Ú
stacklevelT)ÚwarningsÚwarnÚDeprecationWarningr©Út©rúXd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/testing/_private/decorators.pyrs $ÿTcs tjdtdd‡fdd„}|S)aZ
    .. deprecated:: 1.21
        This decorator is retained for compatibility with the nose testing framework, which is being phased out.
        Please use the nose2 or pytest frameworks instead.
 
    Signals to nose that this function is or is not a test.
 
    Parameters
    ----------
    tf : bool
        If True, specifies that the decorated callable is a test.
        If False, specifies that the decorated callable is not a test.
        Default is True.
 
    Notes
    -----
    This decorator can't use the nose namespace, because it can be
    called from a non-test module. See also ``istest`` and ``nottest`` in
    ``nose.tools``.
 
    Examples
    --------
    `setastest` can be used in the following way::
 
      from numpy.testing import dec
 
      @dec.setastest(False)
      def func_with_test_in_name(arg1, arg2):
          pass
 
    r rrcs
ˆ|_|S©N)Z__test__r©ÚtfrrÚset_testfszsetastest.<locals>.set_test)rrr)rrrrrrCs !ÿ cs‡‡fdd„}|S)aj
    .. deprecated:: 1.21
        This decorator is retained for compatibility with the nose testing framework, which is being phased out.
        Please use the nose2 or pytest frameworks instead.
 
    Make function raise SkipTest exception if a given condition is true.
 
    If the condition is a callable, it is used at runtime to dynamically
    make the decision. This is useful for tests that may require costly
    imports, to delay the cost until the test suite is actually executed.
 
    Parameters
    ----------
    skip_condition : bool or callable
        Flag to determine whether to skip the decorated test.
    msg : str, optional
        Message to give on raising a SkipTest exception. Default is None.
 
    Returns
    -------
    decorator : function
        Decorator which, when applied to a function, causes SkipTest
        to be raised when `skip_condition` is True, and the function
        to be called normally otherwise.
 
    Notes
    -----
    The decorator itself is decorated with the ``nose.tools.make_decorator``
    function in order to transmit function name, and various other metadata.
 
    cs”ddl}tjdtddtˆtjjƒr4‡fdd„‰n ‡fdd„‰ddd    „‰‡‡‡‡fd
d „}‡‡‡‡fd d „}|j     ˆ¡r€|}n|}|j
  ˆ¡|ƒS)Nrr rrcsˆƒSrrr©Úskip_conditionrrÚ<lambda>—óz0skipif.<locals>.skip_decorator.<locals>.<lambda>csˆSrrrrrrr™rcSs$|dkrd}n|}d|j›d|›S)z;Skip message with information about function being skipped.Nz"Test skipped due to test conditionzSkipping test: z: )Ú__name__)ÚfuncÚmsgÚoutrrrÚget_msg›sz/skipif.<locals>.skip_decorator.<locals>.get_msgcs$ˆƒrtˆˆˆƒƒ‚n
ˆ||ŽSdS)z"Skipper for normal test functions.N©r©ÚargsÚkwargs©Úfr$r"Úskip_valrrÚ skipper_func¦sz4skipif.<locals>.skip_decorator.<locals>.skipper_funcc?s*ˆƒrtˆˆˆƒƒ‚nˆ||ŽEdHdS)zSkipper for test generators.Nr%r&r)rrÚ skipper_gen­sz3skipif.<locals>.skip_decorator.<locals>.skipper_gen)N) ÚnoserrrÚ
isinstanceÚ collectionsÚabcÚCallableÚutilÚ isgeneratorÚtoolsÚmake_decorator)r*r.r,r-Úskipper©r"r)r*r$r+rÚskip_decoratorŒsÿ 
 zskipif.<locals>.skip_decoratorr)rr"r9rr8rrks!0csVtjdtddˆdkrd‰tˆtjjƒr8‡fdd„‰n ‡fdd„‰‡‡fd    d
„}|S) aÏ
    .. deprecated:: 1.21
        This decorator is retained for compatibility with the nose testing framework, which is being phased out.
        Please use the nose2 or pytest frameworks instead.
 
    Make function raise KnownFailureException exception if given condition is true.
 
    If the condition is a callable, it is used at runtime to dynamically
    make the decision. This is useful for tests that may require costly
    imports, to delay the cost until the test suite is actually executed.
 
    Parameters
    ----------
    fail_condition : bool or callable
        Flag to determine whether to mark the decorated test as a known
        failure (if True) or not (if False).
    msg : str, optional
        Message to give on raising a KnownFailureException exception.
        Default is None.
 
    Returns
    -------
    decorator : function
        Decorator, which, when applied to a function, causes
        KnownFailureException to be raised when `fail_condition` is True,
        and the function to be called normally otherwise.
 
    Notes
    -----
    The decorator itself is decorated with the ``nose.tools.make_decorator``
    function in order to transmit function name, and various other metadata.
 
    r rrNz!Test skipped due to known failurecsˆƒSrrr©Úfail_conditionrrrêrz knownfailureif.<locals>.<lambda>csˆSrrrr:rrrìrcs6ddl}ddlm‰‡‡‡‡fdd„}|j ˆ¡|ƒS)Nrr)ÚKnownFailureExceptioncsˆƒrˆˆƒ‚n
ˆ||ŽSdSrrr&)r<r*Úfail_valr"rrÚ knownfailerôs
z@knownfailureif.<locals>.knownfail_decorator.<locals>.knownfailer)r.Z noseclassesr<r5r6)r*r.r>)r=r")r<r*rÚknownfail_decoratorîs z+knownfailureif.<locals>.knownfail_decorator)rrrr/r0r1r2)r;r"r?r)r;r=r"rr    ¿s#ÿ  cs‡fdd„}|S)a_
    .. deprecated:: 1.21
        This decorator is retained for compatibility with the nose testing framework, which is being phased out.
        Please use the nose2 or pytest frameworks instead.
 
    Filter deprecation warnings while running the test suite.
 
    This decorator can be used to filter DeprecationWarning's, to avoid
    printing them during the test suite run, while checking that the test
    actually raises a DeprecationWarning.
 
    Parameters
    ----------
    conditional : bool or callable, optional
        Flag to determine whether to mark test as deprecated or not. If the
        condition is a callable, it is used at runtime to dynamically make the
        decision. Default is True.
 
    Returns
    -------
    decorator : function
        The `deprecated` decorator itself.
 
    Notes
    -----
    .. versionadded:: 1.4.0
 
    csZddl}tjdtdd‡fdd„}tˆtjjƒr:ˆƒ}nˆ}|rR|j     ˆ¡|ƒSˆSdS)Nrr rrc    s"ttƒˆ||ŽW5QRXdSr)rrr&©r*rrÚ_deprecated_imp#s
z@deprecated.<locals>.deprecate_decorator.<locals>._deprecated_imp)
r.rrrr/r0r1r2r5r6)r*r.rAZcond©Ú conditionalr@rÚdeprecate_decoratorsÿ z'deprecated.<locals>.deprecate_decoratorr)rCrDrrBrr
ýs cCs$ddlm}tjdtdd||ƒS)a…
    .. deprecated:: 1.21
        This decorator is retained for compatibility with the nose testing framework, which is being phased out.
        Please use the nose2 or pytest frameworks instead.
 
    Pytest compatibility class. This implements the simplest level of
    pytest.mark.parametrize for use in nose as an aid in making the transition
    to pytest. It achieves that by adding a dummy var parameter and ignoring
    the doc_func parameter of the base class. It does not support variable
    substitution by name, nor does it support nesting or classes. See the
    pytest documentation for usage.
 
    .. versionadded:: 1.14.0
 
    r)Ú parameterizedr rr)rErrr)ÚvarsÚinputrErrrr 3s  ÿzpython has no sys.getrefcount)T)N)N)T)Ú__doc__Úcollections.abcr0rÚutilsrrrÚ__all__rrrr    r
r r rrrrÚ<module>s
ÿ*
(
T
>
6