
    ,h/                    F   % S SK Jr  S SKJr  S SKrS SKrS SKrS SKJr  S SKJr  S SKJ	r	  S SKJ
r
  S SKJr  S S	KJr  S S
KJr  S SKJr  SSKJr  SSKJr  SSKJr  SSKJr  \R*                  " 5       rSqSqSqSrSqSqSqSqSrSrS\ S'   \RB                  (       a  SSK"J#r#  S\ S'   O " S S5      r$\$" 5       r%\" S\S\4   S9r&SSS.         S.S jjr'S/S  jr( " S! S"5      r)S0S# jr*S1S$ jr+S2S% jr,S3S& jr-S4S' jr. " S( S)5      r/\/" 5       r0 " S* S+5      r1S, r2S- r3g)5    )annotations)	NamespaceN)Any)Callable)Iterable)NoReturn)Optional)Tuple)TypeVar)Union   )mock)requirementsfail   )utilFmainr   options)FixtureFunctionsr   _fixture_functionsc                  T    \ rS rSrS rS r\S 5       rS rS r	S r
S rS	 rS
 rSrg)_NullFixtureFunctions3   c                    S nU$ )Nc                    U $ N fns    Q/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/testing/config.pygo1_NullFixtureFunctions._null_decorator.<locals>.go5   s    	    r   )selfr"   s     r!   _null_decorator%_NullFixtureFunctions._null_decorator4   s     Ir$   c                    [        5       $ r   )	Exceptionr%   argkws      r!   skip_test_exception)_NullFixtureFunctions.skip_test_exception:   s
    ;r$   c                ,    [         R                  " 5       $ r   )r   Mockr%   s    r!   add_to_marker#_NullFixtureFunctions.add_to_marker=   s    99;r$   c                "    U R                  5       $ r   r&   r1   s    r!   mark_base_test_class*_NullFixtureFunctions.mark_base_test_classA       ''))r$   c                "    U R                  5       $ r   r5   )r%   arg_setsr,   s      r!   combinations"_NullFixtureFunctions.combinationsD   r8   r$   c                "    U R                  5       $ r   r5   )r%   
parameterss     r!   param_ident!_NullFixtureFunctions.param_identG   r8   r$   c                "    U R                  5       $ r   r5   r*   s      r!   fixture_NullFixtureFunctions.fixtureJ   r8   r$   c                    g r   r   r1   s    r!   get_current_test_name+_NullFixtureFunctions.get_current_test_nameM   s    r$   c                    U$ r   r   )r%   r    s     r!   
async_test _NullFixtureFunctions.async_testP   s    Ir$   r   N)__name__
__module____qualname____firstlineno__r&   r-   propertyr2   r6   r;   r?   rB   rE   rH   __static_attributes__r   r$   r!   r   r   3   s>    		 
	 
		*	*	*	*		r$   r   _FN.)bound)argnamesid_c                2    [         R                  " X!U S.UD6$ )ab	  Deliver multiple versions of a test based on positional combinations.

This is a facade over pytest.mark.parametrize.


:param \*comb: argument combinations.  These are tuples that will be passed
 positionally to the decorated function.

:param argnames: optional list of argument names.   These are the names
 of the arguments in the test function that correspond to the entries
 in each argument tuple.   pytest.mark.parametrize requires this, however
 the combinations function will derive it automatically if not present
 by using ``inspect.getfullargspec(fn).args[1:]``.  Note this assumes the
 first argument is "self" which is discarded.

:param id\_: optional id template.  This is a string template that
 describes how the "id" for each parameter set should be defined, if any.
 The number of characters in the template should match the number of
 entries in each argument tuple.   Each character describes how the
 corresponding entry in the argument tuple should be handled, as far as
 whether or not it is included in the arguments passed to the function, as
 well as if it is included in the tokens used to create the id of the
 parameter set.

 If omitted, the argument combinations are passed to parametrize as is.  If
 passed, each argument combination is turned into a pytest.param() object,
 mapping the elements of the argument tuple to produce an id based on a
 character value in the same position within the string template using the
 following scheme:

 .. sourcecode:: text

    i - the given argument is a string that is part of the id only, don't
        pass it as an argument

    n - the given argument should be passed and it should be added to the
        id by calling the .__name__ attribute

    r - the given argument should be passed and it should be added to the
        id by calling repr()

    s - the given argument should be passed and it should be added to the
        id by calling str()

    a - (argument) the given argument should be passed and it should not
        be used to generated the id

 e.g.::

    @testing.combinations(
        (operator.eq, "eq"),
        (operator.ne, "ne"),
        (operator.gt, "gt"),
        (operator.lt, "lt"),
        id_="na",
    )
    def test_operator(self, opfunc, name):
        pass

The above combination will call ``.__name__`` on the first member of
each tuple and use that as the "id" to pytest.param().


rS   rR   )r   r;   )rR   rS   combr,   s       r!   r;   r;   [   s%    L **	-/ r$   c                    [        U 0 UD6$ )z+As combination, but takes a single iterable)r;   )arg_iterabler,   s     r!   combinations_listrY      s    ,,,r$   c                      \ rS rSrSrS r\R                  (       a  SS jr\	S 5       r
S rS rS rS	 rSS
 jr\S 5       r\S 5       rSrg)	Variation   _name_argnamec                J    Xl         X l        U H  n[        XXA:H  5        M     g r   )r^   r_   setattr)r%   caseargname
case_namescasenames        r!   __init__Variation.__init__   s#    
"HDH$45 #r$   c                    g r   r   )r%   keys     r!   __getattr__Variation.__getattr__   s    r$   c                    U R                   $ r   )r^   r1   s    r!   nameVariation.name   s    zzr$   c                4    U R                   U R                  :H  $ r   r]   r1   s    r!   __bool__Variation.__bool__   s    zzT]]**r$   c                ,    U R                  5       (       + $ r   )rp   r1   s    r!   __nonzero__Variation.__nonzero__   s    ==?""r$   c                :    U R                    SU R                  < 3$ )N=r_   r^   r1   s    r!   __str__Variation.__str__   s    --$**00r$   c                    [        U 5      $ r   strr1   s    r!   __repr__Variation.__repr__   s    4yr$   c                     [        SU  35        g )NzUnknown r   r1   s    r!   r   Variation.fail   s    xvr$   c                    UR                   $ r   )rm   )cls	variations     r!   idfnVariation.idfn   s    ~~r$   c                    U Vs/ s H  nUSL a  UOUSL a  SU-   OUPM     nn[        U[        4S[        U5      05      nU Vs/ s H  oe" XaU5      PM     sn$ s  snf s  snf )NTFnot_	__slots__)typer[   tuple)r   rc   casescrd   typre   s          r!   generate_casesVariation.generate_cases   s     
 DyG!u*fw&6!K 	 

 LU:.
 DNN:xHz2:NN
 Os   AArw   N)ri   r|   returnbool)r   r   )rJ   rK   rL   rM   r   rf   typingTYPE_CHECKINGrj   rN   rm   rp   rs   rx   r}   r   classmethodr   r   rO   r   r$   r!   r[   r[      so    %I6 4 +#1    O Or$   r[   c           
        [         R                  " U 5      (       a'  U R                  nU " S5      n[        X!5      S 5       nU$ U nU Vs/ s H-  n[	        U[
        5      (       a  [        U5      S:X  a  UOUS4PM/     nn[        R                  X% VVs/ s H  u  pgUPM	     snn5      n[        [        X5       V	V
Vs/ s H'  u  n	u  pUb  U	R                  X4OU	R                  U	4PM)     snn
n	SUS.6$ s  snf s  snnf s  snn
n	f )ai  a helper around testing.combinations that provides a single namespace
that can be used as a switch.

e.g.::

    @testing.variation("querytyp", ["select", "subquery", "legacy_query"])
    @testing.variation("lazy", ["select", "raise", "raise_on_sql"])
    def test_thing(self, querytyp, lazy, decl_base):
        class Thing(decl_base):
            __tablename__ = "thing"

            # use name directly
            rel = relationship("Rel", lazy=lazy.name)

        # use as a switch
        if querytyp.select:
            stmt = select(Thing)
        elif querytyp.subquery:
            stmt = select(Thing).subquery()
        elif querytyp.legacy_query:
            stmt = Session.query(Thing)
        else:
            querytyp.fail()

The variable provided is a slots object of boolean variables, as well
as the name of the case itself under the attribute ".name"

Nc              3  (   #    UR                   v   g 7fr   )param)r%   requests     r!   r"   variation.<locals>.go  s     --s   r   iarU   )inspect
isfunctionrJ   variation_fixture
isinstancer   lenr[   r   r;   zipr^   )argname_or_fnr   rc   r"   entrycases_plus_limitationsr   l
variationsr   rb   
limitations               r!   r   r      s<   < -((((d#	7	*	  
+	  	  E 5%((SZ1_     )) 67 6! 67J  252	

2-	-D ) )8ooy122	

   8	

s   	4C5C:=.D c                Z    [        [        R                  X5      [        R                  US9$ )N)paramsidsscope)rB   r[   r   r   )rc   r   r   s      r!   r   r   &  s'    ''7NN r$   c                 .    [         R                  " U 0 UD6$ r   )r   rB   )r+   r,   s     r!   rB   rB   .  s    %%s1b11r$   c                 *    [         R                  5       $ r   )r   rE   r   r$   r!   rE   rE   2  s    3355r$   c                 *    [         R                  5       $ r   )r   r6   r   r$   r!   r6   r6   6  s    2244r$   c                      \ rS rSrSS jrSrg)_AddToMarkeri:  c                6    [        [        R                  U5      $ r   )getattrr   r2   )r%   attrs     r!   rj   _AddToMarker.__getattr__;  s    )77>>r$   r   N)r   r|   r   r   )rJ   rK   rL   rM   rj   rO   r   r$   r!   r   r   :  s    ?r$   r   c                      \ rS rSrS r\R                  " 5       r\" 5       r	S r
\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S	 5       r\S
 5       r\S 5       rS rSrg)ConfigiB  c                4   U R                  U5        Xl        X l        X0l        X@l        SU l        SU l        UR                  R                  =(       a?    [        R                  " UR                  R                  R                  SS5      5      (       + U l        g )Ntest_schematest_schema_2async_fallbackF)	_set_namedbdb_optsr   file_configr   r   dialectis_asyncr   asboolurlqueryget)r%   r   r   r   r   s        r!   rf   Config.__init__C  sr    r&(,

++ 
DKKFFLL-u55
 1
r$   c                p   UR                   R                  (       a  SOSnUR                   R                  (       aW  SR                  S UR                   R                   5       5      nUR                  < SUR
                  < U< SU< S3U l        g UR                  < SUR
                  < U< 3U l        g )N_async .c              3  8   #    U  H  n[        U5      v   M     g 7fr   r{   ).0toks     r!   	<genexpr>#Config._set_name.<locals>.<genexpr>V  s     N/M3s88/Ms   +z_[])r   r   server_version_infojoinrm   driver)r%   r   suffixsvis       r!   r   Config._set_nameS  sn    ZZ00b::))((Nrzz/M/MNNC*,''299fcJDI%'WWbii@DIr$   c                    [        XX45      n[        =(       d    UR                  qU R                  R	                  U5        U$ )z}add a config as one of the global configs.

If there are no configs set up yet, this config also
gets set as the "_current".
)r   	any_asyncr   _configsadd)r   r   r   r   r   cfgs         r!   registerConfig.register[  s7     R'7
 -	
r$   c                    Uq UR                  R                  qUR                  qUR
                  qUR                  qUR                  =Ul        qg r   )_currentr   r   db_urlr   r   r   r   config	namespaces      r!   set_as_currentConfig.set_as_currentn  sE     ..((,,"II%	rr$   c                    [         (       d   S5       eU R                  [        U[         R                  [         R                  [         R
                  5      U5        g )Nz*Can't push without a default Config set up)r   pushr   r   r   r   )r   r   r   s      r!   push_engineConfig.push_enginex  sF    xEEExH$$h&6&68L8L 		
r$   c                d    U R                   R                  [        5        U R                  X5        g r   )_stackappendr   r   r   s      r!   r   Config.push  s"    

(#6-r$   c                    U R                   (       a.  U R                   S   nU R                   S	 U R                  X!5        g g )N)r   r   )r   r   r   s      r!   pop
Config.pop  s4    ::zz"~H

2x3	 r$   c                    U R                   (       a:  U R                  U R                   S   U5        U R                   R                  5         g g )Nr   )r   r   clear)r   r   s     r!   resetConfig.reset  s6    ::szz!}i8JJ r$   c                    U R                   $ r   )r   )r   s    r!   all_configsConfig.all_configs  s    ||r$   c              #  V   #    U R                  5        H  nUR                  v   M     g 7fr   )r   r   )r   r   s     r!   all_dbsConfig.all_dbs  s     ??$C&&L %s   ')c                    [        U5        g r   )	skip_test)r%   msgs     r!   r   Config.skip_test  s	    #r$   )r   r   r   r   rm   r   r   r   N)rJ   rK   rL   rM   rf   collectionsdequer   setr   r   r   r   r   r   r   r   r   r   r   r   rO   r   r$   r!   r   r   B  s    
  FuHA  $ & & 
 
 . . 4 4  
    r$   r   c                ,    [         R                  U 5      er   )r   r-   )r   s    r!   r   r     s    

0
0
55r$   c                ,    [         R                  U 5      $ r   )r   rH   r   s    r!   rH   rH     s    ((,,r$   )
rV   zUnion[Any, Tuple[Any, ...]]rR   Optional[str]rS   r  r,   r|   r   zCallable[[_FN], _FN])rX   zIterable[Tuple[Any, ...]]r   )function)r+   r   r,   r   r   r   )r   r|   )r   r   )4
__future__r   argparser   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   _requirementsr   r   SuiteRequirementsr   r   r   r   r   r   r   r   identr   __annotations__r   plugin.plugin_baser   r   r   rP   r;   rY   r[   r   r   rB   rE   r6   r   r2   r   r   rH   r   r$   r!   <module>r     sY   #              +   ..0		
	 	4(( D /0 e8CH-.
 #H&HH 
H 	H
 HV-
3O 3OlBJ265? ?
 ] ]@6-r$   