$19 GRAYBYTE WORDPRESS FILE MANAGER $28

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.15.130 | ADMIN IP 216.73.216.174
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/hc_python/lib/python3.12/site-packages/nose/plugins/__pycache__/

HOME
Current File : /opt/hc_python/lib/python3.12/site-packages/nose/plugins/__pycache__//attrib.cpython-312.pyc
�

H��g�%����dZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
Z
ejd�Zejdk\Zd�Zdd	�ZGd
�d�ZGd�d
e�Zy)aAttribute selector plugin.

Oftentimes when testing you will want to select tests based on
criteria rather then simply by filename. For example, you might want
to run all tests except for the slow ones. You can do this with the
Attribute selector plugin by setting attributes on your test methods.
Here is an example:

.. code-block:: python

    def test_big_download():
        import urllib
        # commence slowness...

    test_big_download.slow = 1

Once you've assigned an attribute ``slow = 1`` you can exclude that
test and all other tests having the slow attribute by running ::

    $ nosetests -a '!slow'

There is also a decorator available for you that will set attributes.
Here's how to set ``slow=1`` like above with the decorator:

.. code-block:: python

    from nose.plugins.attrib import attr
    @attr('slow')
    def test_big_download():
        import urllib
        # commence slowness...

And here's how to set an attribute with a specific value:

.. code-block:: python

    from nose.plugins.attrib import attr
    @attr(speed='slow')
    def test_big_download():
        import urllib
        # commence slowness...

This test could be run with ::

    $ nosetests -a speed=slow

In Python 2.6 and higher, ``@attr`` can be used on a class to set attributes
on all its test methods at once.  For example:

.. code-block:: python

    from nose.plugins.attrib import attr
    @attr(speed='slow')
    class MyTestCase:
        def test_long_integration(self):
            pass
        def test_end_to_end_something(self):
            pass

Below is a reference to the different syntaxes available.

Simple syntax
-------------

Examples of using the ``-a`` and ``--attr`` options:

* ``nosetests -a status=stable``
   Only runs tests with attribute "status" having value "stable"

* ``nosetests -a priority=2,status=stable``
   Runs tests having both attributes and values

* ``nosetests -a priority=2 -a slow``
   Runs tests that match either attribute

* ``nosetests -a tags=http``
   If a test's ``tags`` attribute was a list and it contained the value
   ``http`` then it would be run

* ``nosetests -a slow``
   Runs tests with the attribute ``slow`` if its value does not equal False
   (False, [], "", etc...)

* ``nosetests -a '!slow'``
   Runs tests that do NOT have the attribute ``slow`` or have a ``slow``
   attribute that is equal to False
   **NOTE**:
   if your shell (like bash) interprets '!' as a special character make sure to
   put single quotes around it.

Expression Evaluation
---------------------

Examples using the ``-A`` and ``--eval-attr`` options:

* ``nosetests -A "not slow"``
  Evaluates the Python expression "not slow" and runs the test if True

* ``nosetests -A "(priority > 5) and not slow"``
  Evaluates a complex Python expression and runs the test if True

�N)�
isfunction)�Plugin)�tolistznose.plugins.attrib)��c������fd�}|S)zgDecorator that adds attributes to classes or functions
    for use with the Attribute (-a) plugin.
    c�z���D]}t||d���j�D]\}}t|||��|S)NT)�setattr�items)�ob�name�value�args�kwargss   ���B/opt/hc_python/lib/python3.12/site-packages/nose/plugins/attrib.py�wrap_obzattr.<locals>.wrap_obws>����D��B��d�#��!�<�<�>�K�D�%��B��e�$�*��	��)rrrs`` r�attrrss�����Nrc�f�t�}t|||�}||ur|�
t|||�}||ur|S|S)z�Look up an attribute on a method/ function. 
    If the attribute isn't found there, looking it up in the
    method's class, if any.
    )�object�getattr)�method�cls�	attr_name�default�Missingrs      r�get_method_attrrsE��
�h�G��F�I�w�/�E����C�O���Y��0��������Lrc��eZdZdZd�Zd�Zy)�
ContextHelperz�Object that can act as context dictionary for eval and looks up
    names as attributes on a method/ function and its class. 
    c� �||_||_y�N)rr��selfrrs   r�__init__zContextHelper.__init__�s�������rc�D�t|j|j|�Sr")rrr)r$r
s  r�__getitem__zContextHelper.__getitem__�s���t�{�{�D�H�H�d�;�;rN)�__name__�
__module__�__qualname__�__doc__r%r'rrrr r �s����<rr c�6�eZdZdZd�Zd�Zd�Zd	d�Zd�Zd�Z	y)
�AttributeSelectorz<Selects test cases to be run based on their attributes.
    c�<�tj|�g|_yr")rr%�attribs)r$s rr%zAttributeSelector.__init__�s���������rc
��|jdddd|jd�dd��tr(|jd	d
ddd|jd
�d��yy)zRegister command line optionsz-az--attrr�append�	NOSE_ATTR�ATTRzARun only tests that have attributes specified by ATTR [NOSE_ATTR])�dest�actionr�metavar�helpz-Az--eval-attr�	eval_attr�EXPR�NOSE_EVAL_ATTRzaRun only tests for whose attributes the Python expression EXPR evaluates to True [NOSE_EVAL_ATTR])r4r6r5rr7N)�
add_option�get�	compat_24)r$�parser�envs   r�optionszAttributeSelector.options�sl�����$��%�h�"%�'�'�+�"6�"(� :�		�	;�����d�M�#.��x�&)�g�g�.>�&?�$9�
�
:�rc�P�g|_trI|jr=t|j�}|D]#}d�}|jj	||fg��%|j
r�t|j
�}|D]�}g}|j
�jd�D]U}|s�|jdd�}	t|	�dkDr|	\}
}n|	d}
|
ddk(r|
dd}
d}nd	}|j	|
|f��W|jj	|���|jrd	|_	yy)
aConfigure the plugin and system, based on selected options.

        attr and eval_attr may each be lists.

        self.attribs will be a list of lists of tuples. In that list, each
        list is a group of attributes, all of which must match for the rule to
        match.
        c�0�t|dt||��Sr")�evalr )�expr�objrs   r�eval_in_contextz4AttributeSelector.configure.<locals>.eval_in_context�s����d�M�#�s�,C�D�Dr�,�=�r�!NFT)
r/r=r8rr1r�strip�split�len�enabled)r$r@�configr8rrF�std_attr�
attr_group�attribr�keyrs            r�	configurezAttributeSelector.configure�s'�������*�*��w�0�0�1�I�!��E����#�#�d�O�%<�$=�>�"��<�<��g�l�l�+�H� ���
�"�j�j�l�0�0��5�F�!� �"�L�L��a�0�E��5�z�A�~�&+�
��U�#�A�h���q�6�S�=�#&�a�b�'�C�$)�E�%)�E��%�%�s�E�l�3�)6�*���#�#�J�/�1!�2�<�<��D�L�rNc	�P�d}|jD�]}d}|D]�\}}t|||�}t|tj�r||||�r�8d}n�|durt|�r�Ld}n�|durt|�s�`d}n�t
|�ttfvrEt|�j�|D�	cgc]}	t|	�j���c}	vs��d}n?||k7s��t|�j�t|�j�k7s��d}n|xs|}��|ryycc}	w)z�Verify whether a method has the required attributes
        The method is considered a match if it matches all attributes
        for any attribute group.
        .FTN)r/r�
isinstance�collections�Callable�bool�type�list�tuple�str�lower)
r$rr�any�group�matchrSrr�xs
          r�validateAttribz AttributeSelector.validateAttrib�s,�����\�\�E��E�#�
��U�&�v�s�C�8���e�[�%9�%9�:� ��f�c�2� %����d�]���:� %����e�^��D�z� %����$�Z�D�%�=�0��u�:�+�+�-�;?�2A�;?�a�36�a�&�,�,�.�;?�2A�A� %�����
���J�,�,�.�#�d�)�/�/�2C�C� %���7$�8�,��C�="�>����2As�. D#
c�$�|j|�S)z5Accept the function if its attributes match.
        )rc)r$�functions  r�wantFunctionzAttributeSelector.wantFunctions���"�"�8�,�,rc�r�	|jj}|j||�S#t$rYywxYw)z3Accept the method if its attributes match.
        F)�__self__�	__class__�AttributeErrorrcr#s   r�
wantMethodzAttributeSelector.wantMethods?��	��/�/�+�+�C��"�"�6�3�/�/���	��	�s�*�	6�6r")
r(r)r*r+r%r@rTrcrfrkrrrr-r-�s'����:�"3 �j*�X-�
0rr-)F)r+�inspect�logging�os�sysr�nose.plugins.baser�	nose.utilrrW�	getLogger�log�version_infor=rrr r-rrr�<module>rusk��e�L��	�
��$����g���-�.������&�	�
��	<�	<�F0��F0r


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
4 Apr 2025 8.03 AM
root / root
0755
__init__.cpython-312.pyc
6.404 KB
4 Apr 2025 8.03 AM
root / root
0644
allmodules.cpython-312.pyc
2.301 KB
4 Apr 2025 8.03 AM
root / root
0644
attrib.cpython-312.pyc
9.89 KB
4 Apr 2025 8.03 AM
root / root
0644
base.cpython-312.pyc
30.225 KB
4 Apr 2025 8.03 AM
root / root
0644
builtin.cpython-312.pyc
1.157 KB
4 Apr 2025 8.03 AM
root / root
0644
capture.cpython-312.pyc
5.098 KB
4 Apr 2025 8.03 AM
root / root
0644
collect.cpython-312.pyc
4.975 KB
4 Apr 2025 8.03 AM
root / root
0644
cover.cpython-312.pyc
13.917 KB
4 Apr 2025 8.03 AM
root / root
0644
debug.cpython-312.pyc
3.077 KB
4 Apr 2025 8.03 AM
root / root
0644
deprecated.cpython-312.pyc
2.106 KB
4 Apr 2025 8.03 AM
root / root
0644
doctests.cpython-312.pyc
21.004 KB
4 Apr 2025 8.03 AM
root / root
0644
errorclass.cpython-312.pyc
9.29 KB
4 Apr 2025 8.03 AM
root / root
0644
failuredetail.cpython-312.pyc
2.273 KB
4 Apr 2025 8.03 AM
root / root
0644
isolate.cpython-312.pyc
5.177 KB
4 Apr 2025 8.03 AM
root / root
0644
logcapture.cpython-312.pyc
12.53 KB
4 Apr 2025 8.03 AM
root / root
0644
manager.cpython-312.pyc
21.718 KB
4 Apr 2025 8.03 AM
root / root
0644
multiprocess.cpython-312.pyc
38.254 KB
4 Apr 2025 8.03 AM
root / root
0644
plugintest.cpython-312.pyc
17.021 KB
4 Apr 2025 8.03 AM
root / root
0644
prof.cpython-312.pyc
6.642 KB
4 Apr 2025 8.03 AM
root / root
0644
skip.cpython-312.pyc
2.459 KB
4 Apr 2025 8.03 AM
root / root
0644
testid.cpython-312.pyc
11.73 KB
4 Apr 2025 8.03 AM
root / root
0644
xunit.cpython-312.pyc
16.276 KB
4 Apr 2025 8.03 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF