
    [Fie                     >   U d Z ddlZddlmZ ddlZddlZddlZddlmZ ddl	Z	ddl
Z
ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddlm Z  ddlm!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ddl*m,Z, ddl-m.Z. ddl-m/Z/ ddl0m1Z1 ddl0m2Z2 dd l3m4Z4 dd!l5m6Z6 dd"l7m8Z8 dd#l9m:Z: er
ddl;Z;dd$lm<Z< d%Z=d&Z>d'Z?d(Z@d)ZAe=e>e?e@eAfZBdaCdaDeed*      eEd+<   d,e)d-dfd.ZFd\d/ZGd0ed1e.d-eed2      fd3ZHd4ed-eIfd5ZJd6e'd4ed1e.d-eIfd7ZKd4ed-eIfd8ZL G d9 d:e!      ZM G d; d<eN      ZOd-ed=   fd>ZP	 	 	 	 d]d?ed*   d@eeI   dAeQdBeId-d=f
dCZR G dD dEe/      ZSd-eeTeQf   fdFZUd6e'd-eQfdGZVd6e'd-eIfdHZW G dI dJe6      ZXd^dKZYdLeZd-eIfdMZ[ed-edN   fdO       Z\ G dP dQe6      Z]d-ed*   fdRZ^d_dSZ_d-eQfdTZ`d-eQfdUZad-eQfdVZbdWeTd-eQfdXZc e+dYZ      d-eeTef   fd[       Zdy)`z4Discover and run doctests in modules and test files.    N)contextmanager)Path)Any)Callable)Dict)	Generator)Iterable)List)Optional)Pattern)Sequence)Tuple)Type)TYPE_CHECKING)Union)outcomes)ExceptionInfo)ReprFileLocation)TerminalRepr)TerminalWritersafe_getattr)Config)Parser)fixture)
TopRequest)	Collector)Item)OutcomeException)skip
fnmatch_ex)Module)approx)PytestWarning)Selfnonecdiffndiffudiffonly_first_failuredoctest.OutputCheckerCHECKER_CLASSparserreturnc                 ~   | j                  ddddg       | j                  ddd	       | j                  d
      }|j                  ddddd       |j                  dt        j                  ddt
        d       |j                  ddg ddd       |j                  ddddd       |j                  dddd d!       y )"Ndoctest_optionflagszOption flags for doctestsargsELLIPSIS)typedefaultdoctest_encodingzEncoding used for doctest fileszutf-8)r5   collectz--doctest-modules
store_trueFzRun doctests in all .py modulesdoctestmodules)actionr5   helpdestz--doctest-reportr*   z9Choose another output format for diffs on doctest failuredoctestreport)r4   r5   r;   choicesr<   z--doctest-globappendpatz2Doctests file matching pattern, default: test*.txtdoctestglob)r:   r5   metavarr;   r<   z--doctest-ignore-import-errorsz Ignore doctest collection errorsdoctest_ignore_import_errorsz--doctest-continue-on-failurez<For a given doctest, continue to run after the first failuredoctest_continue_on_failure)addinigetgroup	addoptionstrlowerDOCTEST_REPORT_CHOICES)r.   groups     a/var/www/html/BankruptcyAI-uat/bankruptcy-ai/venv/lib/python3.12/site-packages/_pytest/doctest.pypytest_addoptionrM   I   s    
MM#	   MM=w   OOI&E	OO.   
OOYYH&   
OOA   
OO(/+   
OO'K*      c                      d a y N)RUNNER_CLASS rN   rL   pytest_unconfigurerS   {   s	     LrN   	file_pathparent)DoctestModuleDoctestTextfilec                    |j                   }| j                  dk(  rM|j                  j                  r6t	        t        |       t        |       f      st        j                  ||       S y t        || |      rt        j                  ||       S y )Nz.pypath)configsuffixoptionr9   any_is_setup_py_is_main_pyrV   from_parent_is_doctestrW   )rT   rU   r[   s      rL   pytest_collect_filerc      s     ]]F5 =='')$k)&<=1
 !,,V),DD  
VY	/**6	*BBrN   rZ   c                 V    | j                   dk7  ry| j                         }d|v xs d|v S )Nzsetup.pyFs
   setuptoolss	   distutils)name
read_bytes)rZ   contentss     rL   r_   r_      s2    yyJ HH$@(@@rN   r[   c                     j                   dv r|j                  j                        ry| j                  d      xs dg}t	        fd|D              S )N)z.txtz.rstTrA   z	test*.txtc              3   6   K   | ]  }t        |        y wrP   r!   ).0globrZ   s     rL   	<genexpr>z_is_doctest.<locals>.<genexpr>   s     8$z$%8s   )r\   session
isinitpath	getoptionr^   )r[   rZ   rU   globss    `  rL   rb   rb      sL    {{&&6>>+D+DT+J]+<}E8%888rN   c                      | j                   dk(  S )Nz__main__.py)re   rY   s    rL   r`   r`      s    99%%rN   c                   B    e Zd Zdeeeee   f      ddfdZdeddfdZ	y)ReprFailDoctestreprlocation_linesr/   Nc                     || _         y rP   )rt   )selfrt   s     rL   __init__zReprFailDoctest.__init__   s     #5rN   twc                 ~    | j                   D ].  \  }}|D ]  }|j                  |        |j                  |       0 y rP   )rt   line
toterminal)rv   rx   reprlocationlinesrz   s        rL   r{   zReprFailDoctest.toterminal   sD    #'#:#: 	(L% ##B'	(rN   )
__name__
__module____qualname__r   r   r   rH   rw   r   r{   rR   rN   rL   rs   rs      s>    5"*51A8C=1P+Q"R5	5
(^ ( (rN   rs   c                   .     e Zd Zded   ddf fdZ xZS )MultipleDoctestFailuresfailureszdoctest.DocTestFailurer/   Nc                 0    t         |           || _        y rP   )superrw   r   )rv   r   	__class__s     rL   rw   z MultipleDoctestFailures.__init__   s     rN   )r~   r   r   r   rw   __classcell__r   s   @rL   r   r      s!    !*B!C ! ! !rN   r   doctest.DocTestRunnerc                  >    dd l  G fddj                        } | S )Nr   c                        e Zd ZdZ	 	 	 	 dded   dee   dededdf
 fd	Zd
ddddeddffdZ	d
dddde
ee   eej                  f   ddffdZ xZS )/_init_runner_class.<locals>.PytestDoctestRunnerzRunner to collect failures.

        Note that the out variable in this case is a list instead of a
        stdout-like object.
        Ncheckerr,   verboseoptionflagscontinue_on_failurer/   c                 8    t         |   |||       || _        y )N)r   r   r   )r   rw   r   )rv   r   r   r   r   r   s        rL   rw   z8_init_runner_class.<locals>.PytestDoctestRunner.__init__   s!     GWg;W':D$rN   testdoctest.DocTestexamplezdoctest.Examplegotc                 l     j                   |||      }| j                  r|j                  |       y |rP   )DocTestFailurer   r?   )rv   outr   r   r   failuredoctests         rL   report_failurez>_init_runner_class.<locals>.PytestDoctestRunner.report_failure   s5     -g,,T7C@G''

7#rN   exc_infoc                     t        |d   t              r|d   t        |d   t        j                        rt	        j
                  d        j                  |||      }| j                  r|j                  |       y |)N   zQuitting debugger)	
isinstancer   bdbBdbQuitr   exitUnexpectedExceptionr   r?   )rv   r   r   r   r   r   r   s         rL   report_unexpected_exceptionzK_init_runner_class.<locals>.PytestDoctestRunner.report_unexpected_exception   sm     (1+'78qk!(1+s{{3121g11$JG''

7#rN   NNr   T)r~   r   r   __doc__r   boolintrw   rH   r   r   r   BaseExceptiontypesTracebackTyper   r   )r   r   s   @rL   PytestDoctestRunnerr      s    	 :>&* (,	;56	; d^	; 		;
 "&	; 	;	 $	 '		
 	 		 $	 '		
 D/@S@SST	 	 	rN   r   )r   DebugRunner)r   r   s    @rL   _init_runner_classr      s!    -g11 -^ rN   r   r   r   r   c                 @    t         
t               a t        | |||      S )Nr   r   r   r   )rQ   r   r   s       rL   _get_runnerr      s-     )+ /	 rN   c                        e Zd Zdedddddddd	f
 fd
Zedddeddddddf
 fd       ZddZddZddZ	ddZ
dee   deeef   f fdZdeedef   ee   ef   fdZ xZS )DoctestItemre   rU   z%Union[DoctestTextfile, DoctestModule]runnerr   dtestr   r/   Nc                     t         |   ||       || _        || _        d | _        | j
                  j                  }|j                  | d d       }|| _        |j                  | _
        | j                          y )N)nodefunccls)r   rw   r   r   objrm   _fixturemanagergetfixtureinfo_fixtureinfonames_closurefixturenames_initrequest)rv   re   rU   r   r   fmfixtureinfor   s          rL   rw   zDoctestItem.__init__   ss     	v&
 \\))''T$'G''55rN   r&   c                *    t         |   ||||      S )zThe public named constructor.)re   rU   r   r   )r   ra   )r   rU   re   r   r   r   s        rL   ra   zDoctestItem.from_parent  s     w"VFRW"XXrN   c                 6    i | _         t        | d      | _        y )NT)	_ispytest)funcargsr   _requestrv   s    rL   r   zDoctestItem._initrequest  s    +-"448rN   c                 .   | j                   j                          t        | j                   j                        }| j                   j                  d      j	                         D ]
  \  }}|||<    | j
                  j                  j                  |       y )N)
getfixturedoctest_namespace)r   _fillfixturesdictgetfixturevalueitemsr   rp   update)rv   rp   re   values       rL   setupzDoctestItem.setup#  ss    ##% = =>==889LMSSU 	 KD%E$K	 

&rN   c                     t        | j                         | j                          g }| j                  j	                  | j                  |       |rt        |      y )N)r   )_check_all_skippedr   $_disable_output_capturing_for_darwinr   runr   )rv   r   s     rL   runtestzDoctestItem.runtest*  sL    4::&11335 	

1)(33 rN   c                 J   t        j                         dk7  ry| j                  j                  j	                  d      }|rd|j                  d       |j                         \  }}t        j                  j                  |       t        j                  j                  |       yy)zFDisable output capturing. Otherwise, stdout is lost to doctest (#985).DarwinNcapturemanagerT)in_)platformsystemr[   pluginmanager	getpluginsuspend_global_captureread_global_capturesysstdoutwritestderr)rv   capmanr   errs       rL   r   z0DoctestItem._disable_output_capturing_for_darwin4  s~    ??(**445EF))d)3113HCJJS!JJS!	 rN   excinfoc                    dd l }d }t        |j                  |j                  |j                  f      r|j                  g}n0t        |j                  t
              r|j                  j                  }|t        | !  |      S g }|D ]X  }|j                  }|j                  }|j                  }|j                  d }	n|j                  |j                  z   dz   }	t        |      j                  }
t        ||	|
      }t!               }t#        | j$                  j'                  d            }|	|j                  j(                  J |j                  j(                  j+                  d      }|j                  J t-        |      D cg c]  \  }}d||j                  z   dz   |fz   }}}|t/        |j                  dz
  d      |j                  dz    }n=dg}d}|j0                  j+                         D ]  }|j3                  d	| d
|        d} t        ||j                        r0||j5                  ||j6                  |      j9                  d      z  }nwt;        j<                  |j>                        }|dtA        |j                        z  gz  }|tC        jD                  |j>                   D cg c]  }|jG                  d       c}z  }|j3                  ||f       [ tI        |      S c c}}w c c}w )Nr   r   r=   Fz%03d %s	   z?EXAMPLE LOCATION UNKNOWN, not showing all tests of that examplez>>>z???  z...
zUNEXPECTED EXCEPTION: %s)%r   r   r   r   r   r   r   r   repr_failurer   r   filenamelinenor4   r~   r   _get_checker_get_report_choicer[   ro   	docstring
splitlines	enumeratemaxsourcer?   output_differencer   splitr   from_exc_infor   repr	tracebackformat_exceptionstriprs   )rv   r   r   r   rt   r   r   r   r   r   messager|   r   report_choicer}   ixindentrz   inner_excinfor   s                       rL   r   zDoctestItem.repr_failure@  s    	  	 MMG22G4O4OP
  H'>?}}--H7'00 )	=GooG<<D}}H{{"w~~597m,,G+HfgFL"nG.t{{/D/D_/UVM!||--999..99%@{{...GPQVGW=CaIT[[1!4a 88  c'..1"4a87>>A;MN V #NN557 #DLL4xq!78"F# '7#9#9:22W[[-%+ !. ; ;G<L<L M4tM<O<O7PPQQ+4+E+EwGWGW+X&'AGGDM  %%|U&;<S)	=T 1221(s   !K.0K4zos.PathLike[str]c                 b    | j                   | j                  j                  d| j                  z  fS )Nz[doctest] %s)rZ   r   r   re   r   s    rL   
reportinfozDoctestItem.reportinfo  s&    yy$**++^dii-GGGrN   r/   N)r~   r   r   rH   rw   classmethodra   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r   s   @rL   r   r      s     8 (	
 ! 
& 
Y7
Y 	
Y
 (
Y !
Y 

Y 
Y9'4	">3}->3 
sL 	!>3@HE%(:C(?"@(3-QT"TU HrN   r   c                      dd l } t        | j                  | j                  | j                  | j
                  | j                  | j                  t               t               t               	      S )Nr   )	DONT_ACCEPT_TRUE_FOR_1DONT_ACCEPT_BLANKLINENORMALIZE_WHITESPACEr3   IGNORE_EXCEPTION_DETAILCOMPARISON_FLAGSALLOW_UNICODEALLOW_BYTESNUMBER)r   r   r	  r
  r  r3   r  r  _get_allow_unicode_flag_get_allow_bytes_flag_get_number_flagr   s    rL   _get_flag_lookupr    sZ    &==%;;$99!! ' ? ? 11-/)+!
 
rN   c                 ^    | j                  d      }t               }d}|D ]
  }|||   z  } |S )Nr1   r   )getinir  )r[   optionflags_strflag_lookup_tableflag_accflags        rL   get_optionflagsr    sC    mm$9:O(*H ,%d++,OrN   c                 R    | j                  d      }|r| j                  d      rd}|S )NrD   usepdbF)getvalue)r[   r   s     rL   _get_continue_on_failurer     s/     &0M N ??8$"'rN   c                   "    e Zd ZdZdee   fdZy)rW   Nr/   c              #     K   dd l }| j                  j                  d      }| j                  j	                  |      }t        | j                        }| j                  j                  }ddi}t        | j                        }t        d|t               t        | j                              } |j                         }	|	j                  ||||d      }
|
j                  r&t        j                  | |
j                  ||
       y y w)Nr   r6   r~   __main__Fr   r   r   r   re   r   r   )r   r[   r  rZ   	read_textrH   re   r  r   r   r   DocTestParserget_doctestexamplesr   ra   )rv   r   encodingtextr   re   rp   r   r   r.   r   s              rL   r7   zDoctestTextfile.collect  s      ;;%%&89yy""8,tyy>yy~~Z(%dkk2# N 8 E	
 '&&(!!$tXqA==))499V4 *   s   DD)r~   r   r   r   r	   r   r7   rR   rN   rL   rW   rW     s    
C+. rN   rW   c                 f    ddl t        fd| j                  D              }|rt        d       yy)zVRaise pytest.skip() if all examples in the given DocTest have the SKIP
    option set.r   Nc              3   j   K   | ]*  }|j                   j                  j                  d        , yw)FN)optionsgetSKIP)rj   r  r   s     rL   rl   z%_check_all_skipped.<locals>.<genexpr>  s$     PQaiimmGLL%8Ps   03z!all tests skipped by +SKIP option)r   allr)  r    )r   all_skippedr   s     @rL   r   r     s-     P$--PPK01 rN   r   c                      t        | dd      duS )zmReturn if an object is possibly a mock object by checking the
    existence of a highly improbable attribute.1pytest_mock_example_attribute_that_shouldnt_existNr   )r   s    rL   
_is_mockedr5    s     	SMtT	rN   )NNNc               #      K   t         j                  dddt        dt        f   dt        t        t        gt        f      dt        ffd} | t         _        	 d t         _        y# t         _        w xY ww)zContext manager which replaces ``inspect.unwrap`` with a version
    that's aware of mock objects and doesn't recurse into them.Nstopr   .r8  r/   c                     	 ||t         u r  t               S |   fd      S # t        $ r'}t        j                  d|d dt                d }~ww xY w)Nr7  c                 .    t        |       xs        S rP   )r5  )r   _stopr   s    rL   <lambda>zF_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap.<locals>.<lambda>  s    jo6Tt rN   zGot z when unwrapping z.  This is usually caused by a violation of Python's object protocol; see e.g. https://github.com/pytest-dev/pytest/issues/5080)r5  	Exceptionwarningswarnr%   )r   r8  er;  real_unwraps   `  @rL   _mock_aware_unwrapz4_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap  st    	|tz1"4j99Et*TUU 	MMqe,TH 5C C 	 	s   - - 	A"AA)inspectunwrapr   r   r   )rB  rA  s    @rL   _patch_unwrap_mock_awarerE    sn      ..K MQsCx +3HcUCZ4H+I	" (GN%$s   AA9A) A9)A66A9c                       e Zd Zdee   fdZy)rV   r/   c              #   r  K   dd l } G d d|j                        }	 | j                  }| j                  j                  j                  |         |       }t        | j
                        }t        d|t               t        | j
                              }|j!                  |j"                        D ]4  }|j$                  st&        j)                  | |j*                  ||       6 y # t        j                  $ r9 | j
                  j                  d      rt        d| j                  z         n Y 
w xY ww)	Nr   c                   b     e Zd ZdZ fdZ	 	 d fdZej                  dk  r	 fdZ xZ	S  xZ	S )5DoctestModule.collect.<locals>.MockAwareDocTestFinderzA hackish doctest finder that overrides stdlib internals to fix a stdlib bug.

            https://github.com/pytest-dev/pytest/issues/3456
            https://bugs.python.org/issue25532
            c                     t        |t              rt        |d|      }t        |d      rt	        j
                  |      }t        |   ||      S )a3  Doctest code does not take into account `@property`, this
                is a hackish way to fix it. https://bugs.python.org/issue17446

                Wrapped Doctests will need to be unwrapped so the correct
                line number is returned. This will be reported upstream. #8796
                fget__wrapped__)r   propertygetattrhasattrrC  rD  r   _find_lineno)rv   r   source_linesr   s      rL   rP  zBDoctestModule.collect.<locals>.MockAwareDocTestFinder._find_lineno  sO     c8,!#vs3C3.!..-C w+  rN   c           
          t        |      ry t               5  t        |   |||||||       d d d        y # 1 sw Y   y xY wrP   )r5  rE  r   _find)	rv   testsr   re   modulerQ  rp   seenr   s	           rL   rS  z;DoctestModule.collect.<locals>.MockAwareDocTestFinder._find  sE     c?-/ GMsD&,t  s	   7A )      c                 p    t        |t        j                        r|j                  }t        |   ||      S )a>  `cached_property` objects are never considered a part
                    of the 'current module'. As such they are skipped by doctest.
                    Here we override `_from_module` to check the underlying
                    function instead. https://github.com/python/cpython/issues/107995
                    )r   	functoolscached_propertyr   r   _from_module)rv   rU  objectr   s      rL   r\  zBDoctestModule.collect.<locals>.MockAwareDocTestFinder._from_module#  s2     "&)*C*CD!' !7/??rN   r  )
r~   r   r   r   rP  rS  r   version_infor\  r   r   s   @rL   MockAwareDocTestFinderrI    s;    (		 ')
@ 
@ rN   r_  rC   zunable to import module %rFr$  r%  )r   DocTestFinderr   r   CollectErrorr[   r  r    rZ   rm   r   parsefactoriesr  r   r   r   findr~   r)  r   ra   re   )rv   r   r_  rU  finderr   r   r   s           rL   r7   zDoctestModule.collect  s    5	W%:%: 5	n	XXF 	$$33D9 ()%dkk2# N 8 E	
 KK8 	D}}!--tyyt .  	) %% 	{{##$BC1DII=> ?	s/   D7C( BD7 (D7(AD40D73D44D7N)r~   r   r   r	   r   r7   rR   rN   rL   rV   rV     s    T+. TrN   rV   c                  F    dd l } dd l G fdd| j                        }|S )Nr   c                        e Zd ZW j                  dW j                        ZW j                  dW j                        ZW j                  dW j                        Zde	de	de
def fdZde	de	de	fd	Z xZS )
2_init_checker_class.<locals>.LiteralsOutputCheckerz(\W|^)[uU]([rR]?[\'\"])z(\W|^)[bB]([rR]?[\'\"])a  
            (?P<number>
              (?P<mantissa>
                (?P<integer1> [+-]?\d*)\.(?P<fraction>\d+)
                |
                (?P<integer2> [+-]?\d+)\.
              )
              (?:
                [Ee]
                (?P<exponent1> [+-]?\d+)
              )?
              |
              (?P<integer3> [+-]?\d+)
              (?:
                [Ee]
                (?P<exponent2> [+-]?\d+)
              )
            )
            wantr   r   r/   c                    t         |   |||      ry|t               z  }|t               z  }|t	               z  }|s|s|sydt
        t           dt        dt        f	fd}|r& || j                  |      } || j                  |      }|r& || j                  |      } || j                  |      }|r| j                  ||      }t         |   |||      S )NTFregextxtr/   c                 *    j                  | d|      S )Nz\1\2)sub)rj  rk  res     rL   remove_prefixeszX_init_checker_class.<locals>.LiteralsOutputChecker.check_output.<locals>.remove_prefixes|  s    vveWc22rN   )
r   check_outputr  r  r  r   rH   _unicode_literal_re_bytes_literal_re_remove_unwanted_precision)
rv   rh  r   r   allow_unicodeallow_bytesallow_numberro  r   rn  s
           rL   rp  z?_init_checker_class.<locals>.LiteralsOutputChecker.check_outputq  s    w#D#{;'*A*CCM%(=(??K&)9);;L \3ws| 3# 3# 3 &t'?'?F%d&>&>D&t'='=tD%d&<&<cB55dC@7'c;??rN   c                 .   t        | j                  j                  |            }t        | j                  j                  |            }t        |      t        |      k7  r|S d}t	        ||      D ]!  \  }}|j                  d      }|j                  d      }	|	|j                  d      }	|dn
t        |      }
|	|
t        |	      z  }
t        |j                               t        t        |j                               d|
 z        k(  s|d |j                         |z    |j                         z   ||j                         |z   d  z   }||j                         |j                         z
  |j                         |j                         z
  z
  z  }$ |S )Nr   fraction	exponent1	exponent2
   )abs)list
_number_refinditerlenziprK   r   floatr$   startend)rv   rh  r   wantsgotsoffsetwgrx  exponent	precisions              rL   rs  zM_init_checker_class.<locals>.LiteralsOutputChecker._remove_unwanted_precision  sc   11$78E0056D5zSY&
FE4( J1*+''**=*+''+*># ww{3H!)!1As8}	'X.I#veAGGI.>B
N'SS
 0aggi&01AGGI=AEEGfDTDV@WW  aeeg	1QUUWqwwy5HIIFJ  JrN   )r~   r   r   compileUNICODErq  rr  VERBOSEr~  rH   r   r   rp  rs  r   )r   rn  s   @rL   LiteralsOutputCheckerrg  S  s    
 !jj)CRZZPJJ'A2::NZZ& JJ)

.	@S 	@s 	@ 	@ 	@6	3 	S 	S 	rN   r  )r   rn  OutputChecker)r   r  rn  s     @rL   _init_checker_classr  O  s&    O 5 5 Ob ! rN   c                  6    t         
t               a t               S )a  Return a doctest.OutputChecker subclass that supports some
    additional options:

    * ALLOW_UNICODE and ALLOW_BYTES options to ignore u'' and b''
      prefixes (respectively) in string literals. Useful when the same
      doctest should run in Python 2 and Python 3.

    * NUMBER to ignore floating-point differences smaller than the
      precision of the literal number in the doctest.

    An inner class is used to avoid importing "doctest" at the module
    level.
    )r-   r  rR   rN   rL   r   r     s     +-?rN   c                  .    ddl }  | j                  d      S )z+Register and return the ALLOW_UNICODE flag.r   Nr  r   register_optionflagr  s    rL   r  r    s    &7&&77rN   c                  .    ddl }  | j                  d      S )z)Register and return the ALLOW_BYTES flag.r   Nr  r  r  s    rL   r  r    s    &7&&}55rN   c                  .    ddl }  | j                  d      S )z$Register and return the NUMBER flag.r   Nr  r  r  s    rL   r  r    s    &7&&x00rN   keyc           
          ddl }t        |j                  t        |j                  t
        |j                  t        |j                  t        di|    S )zReturn the actual `doctest` module flag value.

    We want to do it as late as possible to avoid importing `doctest` and all
    its dependencies when parsing options, as it adds overhead and breaks tests.
    r   N)
r   DOCTEST_REPORT_CHOICE_UDIFFREPORT_UDIFFDOCTEST_REPORT_CHOICE_CDIFFREPORT_CDIFFDOCTEST_REPORT_CHOICE_NDIFFREPORT_NDIFF(DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILUREREPORT_ONLY_FIRST_FAILUREDOCTEST_REPORT_CHOICE_NONE)r  r   s     rL   r   r     sN      	$W%9%9#W%9%9#W%9%90'2S2S"A 
 rN   rm   )scopec                      t               S )a  Fixture that returns a :py:class:`dict` that will be injected into the
    namespace of doctests.

    Usually this fixture is used in conjunction with another ``autouse`` fixture:

    .. code-block:: python

        @pytest.fixture(autouse=True)
        def add_np(doctest_namespace):
            doctest_namespace["np"] = numpy

    For more details: :ref:`doctest_namespace`.
    )r   rR   rN   rL   r   r     s     6MrN   r  r   )r   r   r/   N)r/   r,   )er   r   
contextlibr   rZ  rC  ospathlibr   r   r   r   r   typingr   r   r   r   r	   r
   r   r   r   r   r   r   r   r>  _pytestr   _pytest._code.coder   r   r   _pytest._ior   _pytest.compatr   _pytest.configr   _pytest.config.argparsingr   _pytest.fixturesr   r   _pytest.nodesr   r   _pytest.outcomesr   r    _pytest.pathlibr"   _pytest.pythonr#   _pytest.python_apir$   _pytest.warning_typesr%   r   r&   r  r  r  r  r  rJ   rQ   r-   __annotations__rM   rS   rc   r   r_   rb   r`   rs   r=  r   r   r   r   r   rH   r  r  r   rW   r   r]  r5  rE  rV   r  r   r  r  r  r   r   rR   rN   rL   <module>r     s   : 
 %   	   
                   , / + & ' ! , $ ' #  - ! & ! % / # % % % +? ( ,  9=x456 =/V / /d e678At A A9 9d 9I 9$ 9&d &t &
(l 
(!i !2D!89 2l 26" $	-.d^  	
 (CH$ CHL$sCx.  F s V  f >2F t  %),<"= % %:UF UpU!T"9: U!p(8 86s 61# 1C C " 	y4S>  rN   