
    >/i	                         S r SSKrSSKrSSKJr  SSKJr  S r\R                  \R                  " S5      \R                  " S5      S 5       5       5       rg)	a  
============================
B101: Test for use of assert
============================

This plugin test checks for the use of the Python ``assert`` keyword. It was
discovered that some projects used assert to enforce interface constraints.
However, assert is removed with compiling to optimised byte code (`python -O`
producing \*.opt-1.pyc files). This caused various protections to be removed.
Consider raising a semantically meaningful error or ``AssertionError`` instead.

Please see
https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement for
more info on ``assert``.

**Config Options:**

You can configure files that skip this check. This is often useful when you
use assert statements in test cases.

.. code-block:: yaml

    assert_used:
      skips: ['*_test.py', '*test_*.py']

:Example:

.. code-block:: none

    >> Issue: Use of assert detected. The enclosed code will be removed when
       compiling to optimised byte code.
       Severity: Low   Confidence: High
       CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
       Location: ./examples/assert.py:1
    1 assert logged_in
    2 display_assets()

.. seealso::

 - https://bugs.launchpad.net/juniperopenstack/+bug/1456193
 - https://bugs.launchpad.net/heat/+bug/1397883
 - https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement
 - https://cwe.mitre.org/data/definitions/703.html

.. versionadded:: 0.11.0

.. versionchanged:: 1.7.3
    CWE information added

    N)issue)test_propertiesc                     U S:X  a  S/ 0$ g )Nassert_usedskips )names    P/home/james-whalen/.local/lib/python3.13/site-packages/bandit/plugins/asserts.py
gen_configr   >   s    }}     B101Assertc                    UR                  S/ 5       H+  n[        R                  " U R                  U5      (       d  M+    g    [        R                  " [        R
                  [        R                  [        R                  R                  SS9$ )Nr   z`Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.)severity
confidencecwetext)
getfnmatchfilenamebanditIssueLOWHIGHr   CweIMPROPER_CHECK_OF_EXCEPT_COND)contextconfigskips      r
   r   r   C   sg     

7B'??7++T22 ( <<;;II33E r   )__doc__r   r   bandit.corer   r   testr   takes_configtest_idchecksr   r   r   r
   <module>r&      sZ   
1d    /
 fX   r   