Ë
    iKêjk$  ã                   óú  — d dl Z d dlmZ d dlmZ d dlmZmZ d dlm	Z
mZ d dlmZ d dlmZ d dlmZmZ d d	lmZmZ d d
lmZ d dlmZ d dlmZ  edej@                  ¬«      Z! G d„ d«      Z" G d„ de"ejF                  «      Z# G d„ de"ejH                  «      Z$ G d„ de"ejJ                  «      Z% G d„ de"ejL                  «      Z& G d„ de"ejN                  «      Z' e«       de(e!   dejR                  ez  dejR                  e!   fd„«       Z*ejV                  d„ «       Z, e«       	 d$d e(e
jZ                     d!e.dz  dejR                  ez  dejR                  e
jZ                     fd"„«       Z/ejV                  d#„ «       Z0y)%é    N)Úpartial)ÚEllipsisType)ÚAnyÚTypeVar)ÚformsÚtest)Útesting)ÚValidationError)ÚIntegrityErrorÚmodels)ÚrejectÚ
strategies)ÚInvalidArgument)Ú
from_field)Údefines_strategyÚModelT)Úboundc                   ó    — e Zd Zd„ Zd„ Zdd„Zy)ÚHypothesisTestCasec                 ó$   — | j                  «        y ©N)Ú
_pre_setup)Úselfs    úb/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/hypothesis/extra/django/_impl.pyÚsetup_examplez HypothesisTestCase.setup_example   s   € Ø�‰Õó    c                 ó$   — | j                  «        y r   )Ú_post_teardown)r   Úexamples     r   Úteardown_examplez#HypothesisTestCase.teardown_example!   s   € Ø×ÑÕr   Nc                 óÈ   — t        | | j                  «      }t        |dd«      r t        j                  j	                  | |«      S t
        j                  j	                  | |«      S )NÚis_hypothesis_testF)ÚgetattrÚ_testMethodNameÚunittestÚTestCaseÚ__call__ÚdtÚSimpleTestCase)r   ÚresultÚ
testMethods      r   r'   zHypothesisTestCase.__call__$   sS   € Ü˜T 4×#7Ñ#7Ó8ˆ
Ü�:Ð3°UÔ;Ü×$Ñ$×-Ñ-¨d°FÓ;Ð;ä×$Ñ$×-Ñ-¨d°FÓ;Ð;r   r   )Ú__name__Ú
__module__Ú__qualname__r   r    r'   © r   r   r   r      s   „ òòô<r   r   c                   ó   — e Zd Zy)r)   N©r,   r-   r.   r/   r   r   r)   r)   ,   ó   „ Ør   r)   c                   ó   — e Zd Zy)r&   Nr1   r/   r   r   r&   r&   0   r2   r   r&   c                   ó   — e Zd Zy)ÚTransactionTestCaseNr1   r/   r   r   r5   r5   4   r2   r   r5   c                   ó   — e Zd Zy)ÚLiveServerTestCaseNr1   r/   r   r   r7   r7   8   r2   r   r7   c                   ó   — e Zd Zy)ÚStaticLiveServerTestCaseNr1   r/   r   r   r9   r9   <   r2   r   r9   ÚmodelÚfield_strategiesÚreturnc          	      óä  — t        | t        j                  «      st        d| ›d�«      ‚| j                  j
                  D �ci c]  }|j                  |“Œ }}t        |j                  «       «      D ]  \  }}|du sŒt        ||   «      ||<   Œ t        |j                  «       «      D ]ƒ  \  }}||vsŒ|j                  rŒt        |t        j                  «      rŒ3t        |t        t        dd«      «      rŒO|j                  t        j                  j                   u sŒvt        |«      ||<   Œ… |D ]‡  }| j                  j#                  |«      j$                  sŒ)||j'                  |«      i}t)        j*                  |«      |d<   t-        t)        j.                  | j0                  j2                  fi |¤Ž«      c S  t-        t)        j.                  | j0                  j4                  fi |¤Ž«      S c c}w )aå  Return a strategy for examples of ``model``.

    .. warning::
        Hypothesis creates saved models. This will run inside your testing
        transaction when using the test runner, but if you use the dev console
        this will leave debris in your database.

    ``model`` must be an subclass of :class:`~django:django.db.models.Model`.
    Strategies for fields may be passed as keyword arguments, for example
    ``is_staff=st.just(False)``.  In order to support models with fields named
    "model", this is a positional-only parameter.

    Hypothesis can often infer a strategy based the field type and validators,
    and will attempt to do so for any required fields.  No strategy will be
    inferred for an :class:`~django:django.db.models.AutoField`, nullable field,
    foreign key, or field for which a keyword
    argument is passed to ``from_model()``.  For example,
    a Shop type with a foreign key to Company could be generated with::

        shop_strategy = from_model(Shop, company=from_model(Company))

    Like for :func:`~hypothesis.strategies.builds`, you can pass
    ``...`` (:obj:`python:Ellipsis`) as a keyword argument to infer a strategy for
    a field which has a default value instead of using the default.
    zmodel=z must be a subtype of Model.ÚGeneratedFieldr/   Údefaults)Ú
issubclassÚdmÚModelr   Ú_metaÚconcrete_fieldsÚnameÚsortedÚitemsr   Úauto_createdÚ
isinstanceÚ	AutoFieldr#   ÚdefaultÚfieldsÚNOT_PROVIDEDÚ	get_fieldÚprimary_keyÚpopÚstÚfixed_dictionariesÚ_models_implÚbuildsÚobjectsÚupdate_or_createÚget_or_create)r:   r;   ÚfÚfields_by_namerE   ÚvalueÚfieldÚkwargss           r   Ú
from_modelr]   @   s±  € ô: �eœRŸX™XÔ&Ü   Ð(CÐDÓEÐEà).¯©×)DÑ)DÖE A�a—f‘f˜a‘iÐE€NÐEÜÐ.×4Ñ4Ó6Ó7ò F‰ˆˆeØ�CŠ<Ü%/°¸tÑ0DÓ%EÐ˜TÒ"ðFô ˜n×2Ñ2Ó4Ó5ò 7‰ˆˆeàÐ(Ò(Ø×&Ó&Ü˜u¤b§l¡lÕ3Ü˜u¤g¬bÐ2BÀBÓ&GÕHØ—‘¤§¡×!7Ñ!7Ò7ä%/°Ó%6Ð˜TÒ"ð7ð "ò UˆØ�;‰;× Ñ  Ó'×3Ó3ð Ð-×1Ñ1°%Ó8Ð9ˆFÜ!#×!6Ñ!6Ð7GÓ!HˆF�:ÑÜ¤§	¡	¨%¯-©-×*HÑ*HÑ SÈFÑ SÓTÒTðUô œŸ	™	 %§-¡-×"=Ñ"=ÑRÐAQÑRÓSÐSùò5 Fs   ÁG-c                 óL   — 	  | |«      d   S # t         $ r t        «        Y yw xY w)z5Handle the nasty part of drawing a value for models()r   N)r   r   ©ÚdrawÚstrats     r   rS   rS   }   s+   € ðÙ�E‹{˜1‰~ÐøÜò ô 	Žðús   ‚
 �#¢#ÚformÚform_kwargsc           	      ó`  — |xs i }t        | t        j                  «      st        d| ›d�«      ‚ | di |¤Ž}i }|j                  j                  «       D ]L  \  }}t        |t        j                  «      r(t        |j                  «      D ]  \  }}|||› d|› �<   Œ ŒH|||<   ŒN t        |j                  «       «      D ]  \  }}	|	du sŒt        ||   «      ||<   Œ t        |j                  «       «      D ]%  \  }}||vsŒ|j                  rŒt        |«      ||<   Œ' i }
i }|j                  «       D ]-  \  }}||   }t        |t        j                  «      r|n|
}|||<   Œ/ t        t        j                  t!        | fi |¤Žt        j"                  |
«      t        j"                  |«      ¬«      «      S )a  Return a strategy for examples of ``form``.

    ``form`` must be an subclass of :class:`~django:django.forms.Form`.
    Strategies for fields may be passed as keyword arguments, for example
    ``is_staff=st.just(False)``.

    Hypothesis can often infer a strategy based the field type and validators,
    and will attempt to do so for any required fields.  No strategy will be
    inferred for a disabled field or field for which a keyword argument
    is passed to ``from_form()``.

    This function uses the fields of an unbound ``form`` instance to determine
    field strategies, any keyword arguments needed to instantiate the unbound
    ``form`` instance can be passed into ``from_form()`` as a dict with the
    keyword ``form_kwargs``. E.g.::

        shop_strategy = from_form(Shop, form_kwargs={"company_id": 5})

    Like for :func:`~hypothesis.strategies.builds`, you can pass
    ``...`` (:obj:`python:Ellipsis`) as a keyword argument to infer a strategy for
    a field which has a default value instead of using the default.
    zform=z must be a subtype of FormÚ_.)ÚdataÚfilesr/   )r@   ÚdfÚBaseFormr   rL   rG   rI   ÚMultiValueFieldÚ	enumeraterF   r   ÚdisabledÚ	FileFieldÚ_forms_implrQ   rT   r   rR   )rb   rc   r;   Úunbound_formrY   rE   r[   ÚiÚ_fieldrZ   Údata_strategiesÚfile_strategiesÚ
form_fieldÚ
dictionarys                 r   Ú	from_formrv   ˆ   sÓ  € ð@ Ò# €KÜ�dœBŸK™KÔ(Ü   Ð'AÐBÓCÐCñ Ñ&˜+Ñ&€LØ€NØ#×*Ñ*×0Ñ0Ó2ò )‰ˆˆeÜ�eœR×/Ñ/Ô0ô ' u§|¡|Ó4ò 7‘	��6Ø06� $  q¨¨˜}Ò-ñ7ð $)ˆN˜4Ò ð)ô  Ð.×4Ñ4Ó6Ó7ò F‰ˆˆeØ�CŠ<Ü%/°¸tÑ0DÓ%EÐ˜TÒ"ðFô ˜n×2Ñ2Ó4Ó5ò 7‰ˆˆeØÐ'Ò'°·³Ü%/°Ó%6Ð˜TÒ"ð7ð ')€OØ&(€OØ'×-Ñ-Ó/ò !‰ˆˆeØ# DÑ)ˆ
ä)¨*´b·l±lÔC‰OÈð 	ð !ˆ
�4Òð!ô Ü
�	‰	Ü�DÑ(˜KÑ(Ü×&Ñ& Ó7Ü×'Ñ'¨Ó8ô	
óð r   c                 óF   — 	  | |«      S # t         $ r t        «        Y yw xY w)z8Handle the nasty part of drawing a value for from_form()N)r
   r   r_   s     r   rn   rn   â   s'   € ðÙ�E‹{ÐøÜò ô 	Žðús   ‚
 Š Ÿ r   )1r%   Ú	functoolsr   Útypesr   Útypingr   r   Údjangor   rh   r   r(   Údjango.contrib.staticfilesr	   ÚdstÚdjango.core.exceptionsr
   Ú	django.dbr   r   rA   Ú
hypothesisr   r   rQ   Úhypothesis.errorsr   Úhypothesis.extra.django._fieldsr   Ú%hypothesis.strategies._internal.utilsr   rB   r   r   r)   r&   r5   r7   r9   ÚtypeÚSearchStrategyr]   Ú	compositerS   ÚFormÚdictrv   rn   r/   r   r   ú<module>r‰      s˜  ðó Ý Ý ß ç *Ý 5Ý 2ß 2ç /Ý -Ý 6Ý Bá	� §¡Ô	*€÷<ñ <ô	Ð'¨×):Ñ):ô 	ô	Ð! 2§;¡;ô 	ô	Ð,¨b×.DÑ.Dô 	ô	Ð+¨R×-BÑ-Bô 	ô	Ð1°3×3OÑ3Oô 	ñ Óð9TØ�‰<ð9TØ02×0AÑ0AÀLÑ0Pð9Tà×Ñ�vÑò9Tó ð9Tðx ‡�ñó ðñ Óð  $ñVØ
ˆr�w‰w‰-ðVà˜‘ðVð ×)Ñ)¨LÑ8ðVð ×Ñ�r—w‘wÑò	Vó ðVðr ‡�ñó ñr   