
    $g(                        d dl mZ d dlmZ d dlZd dlmZ ddlmZm	Z	m
Z
 ddlmZ ed          d          Zd	Zd
ZdZ G d dej                  Z G d de          Z G d dej                  Z G d dej                  Zd Zd Zd Zd Zd Z G d dej                  Zd Zd ZefdZ d Z!d Z"d  Z#d! Z$d" Z%d# Z&dS )$    )forms)raisesN)DjangoObjectType   )CHOICESFilmReporter   )DjangoFormInputObjectTypeA_1doDOc                   (    e Zd Z G d d          ZdS )FilmFormc                       e Zd ZeZdZdS )FilmForm.Meta N)__name__
__module____qualname__r   modelexcluder       r/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/graphene_django/forms/tests/test_djangoinputobject.pyMetar      s        r   r   Nr   r   r   r   r   r   r   r   r      s<                 r   r   c                   (    e Zd Z G d d          ZdS )ReporterTypec                       e Zd ZeZdZdS )ReporterType.Meta__all__N)r   r   r   r	   r   fieldsr   r   r   r   r       s        r   r   Nr   r   r   r   r   r      s<                 r   r   c                   (    e Zd Z G d d          ZdS )ReporterFormc                       e Zd ZeZdZdS )ReporterForm.Meta)petsemailfansN)r   r   r   r	   r   r   r   r   r   r   r&       s        +r   r   Nr   r   r   r   r$   r$      s<        , , , , , , , , , ,r   r$   c                   J    e Zd Z ej                    Z ej                    ZdS )MyFormN)r   r   r   r   	CharField
text_fieldIntegerField	int_fieldr   r   r   r+   r+   %   s-         ""J""$$IIIr   r+   c                      t          t                    5 }  G d dt                    }d d d            n# 1 swxY w Y   | j        j        d         dk    sJ d S )Nc                       e Zd ZdS )*test_needs_form_class.<locals>.MyInputTypeN)r   r   r   r   r   r   MyInputTyper2   -   s        Dr   r3   r   z4form_class is required for DjangoFormInputObjectType)r   	Exceptionr   valueargs)excr3   s     r   test_needs_form_classr8   *   s    				 c	 	 	 	 	3 	 	 	              
 9>! VVVVVVVs   599c                  p     G d dt                     g d} t          fd| D                       sJ d S )Nc                   (    e Zd Z G d d          ZdS )Dtest_type_from_modelform_has_input_fields.<locals>.ReporterInputTypec                       e Zd ZeZdZdS )Itest_type_from_modelform_has_input_fields.<locals>.ReporterInputType.Meta
first_name	last_namea_choiceNr   r   r   r$   
form_classonly_fieldsr   r   r   r   r=   5   s        %JAKKKr   r   Nr   r   r   r   ReporterInputTyper;   4   sF        	B 	B 	B 	B 	B 	B 	B 	B 	B 	Br   rE   )r?   r@   rA   idc              3   4   K   | ]}|j         j        v V  d S N_metar"   ).0frE   s     r   	<genexpr>z<test_type_from_modelform_has_input_fields.<locals>.<genexpr>:   s/      CCqq%+22CCCCCCr   r   all)r"   rE   s    @r   )test_type_from_modelform_has_input_fieldsrP   3   sr    B B B B B5 B B B
 ;::FCCCCFCCCCCCCCCCr   c                  p     G d dt                     g d} t          fd| D                       sJ d S )Nc                   (    e Zd Z G d d          ZdS )=test_type_from_form_has_input_fields.<locals>.MyFormInputTypec                       e Zd ZeZdS )Btest_type_from_form_has_input_fields.<locals>.MyFormInputType.MetaNr   r   r   r+   rC   r   r   r   r   rU   ?           JJJr   r   Nr   r   r   r   MyFormInputTyperS   >   <        	  	  	  	  	  	  	  	  	  	 r   rX   )r-   r/   rF   c              3   4   K   | ]}|j         j        v V  d S rH   rI   rK   rL   rX   s     r   rM   z7test_type_from_form_has_input_fields.<locals>.<genexpr>C   .      AAQqO)00AAAAAAr   rN   r"   rX   s    @r   $test_type_from_form_has_input_fieldsr^   =   sj             3       /..FAAAA&AAAAAAAAAAr   c                       G d dt                     g d} t          fd| D                       sJ j        j        d         j        t
          j        u sJ d S )Nc                   (    e Zd Z G d d          ZdS )2test_type_custom_id_field.<locals>.MyFormInputTypec                       e Zd ZeZdZdS )7test_type_custom_id_field.<locals>.MyFormInputType.MetapkN)r   r   r   r+   rC   add_id_field_namer   r   r   r   rc   H   s        J $r   r   Nr   r   r   r   rX   ra   G   <        	% 	% 	% 	% 	% 	% 	% 	% 	% 	%r   rX   r-   r/   rd   c              3   4   K   | ]}|j         j        v V  d S rH   rI   r[   s     r   rM   z,test_type_custom_id_field.<locals>.<genexpr>M   r\   r   rd   )r   rO   rJ   r"   typegrapheneIDr]   s    @r   test_type_custom_id_fieldrl   F   s    % % % % %3 % % %
 /..FAAAA&AAAAAAAA '-2hkAAAAAAr   c                       G d dt                     g d} t          fd| D                       sJ j        j        d         j        t
          j        u sJ d S )Nc                   (    e Zd Z G d d          ZdS )7test_type_custom_id_field_type.<locals>.MyFormInputTypec                   8    e Zd ZeZdZ ej        d          ZdS )<test_type_custom_id_field_type.<locals>.MyFormInputType.Metard   FrequiredN)	r   r   r   r+   rC   re   rj   Stringadd_id_field_typer   r   r   r   rq   S   s0        J $ / ? ? ?r   r   Nr   r   r   r   rX   ro   R   sF        	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@r   rX   rg   c              3   4   K   | ]}|j         j        v V  d S rH   rI   r[   s     r   rM   z1test_type_custom_id_field_type.<locals>.<genexpr>Y   r\   r   rd   )r   rO   rJ   r"   ri   rj   rt   r]   s    @r   test_type_custom_id_field_typerw   Q   s    @ @ @ @ @3 @ @ @ /..FAAAA&AAAAAAAA '-2hoEEEEEEr   c                   ,    e Zd Z ej                    ZdS )	MockQueryN)r   r   r   rj   rt   ar   r   r   ry   ry   ]   s        AAAr   ry   c                  <    G d dt                      G fddt          j                   G fddt          j                  } t          j        t
          |           }|                    dd	d
ddi          }|j        J |j        dddiik    sJ d S )Nc                   (    e Zd Z G d d          ZdS )Dtest_mutation_with_form_djangoforminputtype.<locals>.MyFormInputTypec                       e Zd ZeZdS )Itest_mutation_with_form_djangoforminputtype.<locals>.MyFormInputType.MetaNrV   r   r   r   r   r   c   rW   r   r   Nr   r   r   r   rX   r}   b   rY   r   rX   c                   V    e Zd Z G  fdd          Z ej                    ZfdZdS )Ctest_mutation_with_form_djangoforminputtype.<locals>.MyFormMutationc                   (    e Zd Z  d          ZdS )Mtest_mutation_with_form_djangoforminputtype.<locals>.MyFormMutation.ArgumentsTrr   N)r   r   r   	form_data)rX   s   r   	Argumentsr   g   s!        '666IIIr   r   c                     t          |          }|                                r|j        dddk    } |          S  d          S )N)datatext	  )r-   r/   resultF)r+   is_validcleaned_data)_root_infor   formr   MyFormMutations        r   mutatezJtest_mutation_with_form_djangoforminputtype.<locals>.MyFormMutation.mutatel   sh    y)))D}} 5*"(!$/ /  &~V4444!>////r   N)r   r   r   r   rj   Booleanr   r   )rX   r   s   r   r   r   f   sr        	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 "!##	0 	0 	0 	0 	0 	0 	0r   r   c                   8    e Zd Z                                 ZdS )=test_mutation_with_form_djangoforminputtype.<locals>.MutationN)r   r   r   FieldmyForm_mutation)r   s   r   Mutationr   v   s         (..00r   r   querymutationz mutation MyFormMutation($formData: MyFormInputType!) {
            myFormMutation(formData: $formData) {
                result
            }
        }
        formDatar   r   )	textFieldintFieldvariable_valuesmyFormMutationr   T)	r   rj   r   
ObjectTypeSchemary   executeerrorsr   )r   schemar   rX   r   s      @@r   +test_mutation_with_form_djangoforminputtyper   a   s            3      0 0 0 0 0 0 0 0* 0 0 0 1 1 1 1 1 1 18& 1 1 1 _9x@@@F^^	 $6s%K%KL   F =   ;+h-=>>>>>>>r   c            	      P    G d dt                      G fddt          j                   G fddt          j                  } t          j        t
          |           }t          j                            dd	t          
          }|
                    dd|j        ddt          di          }|j        J |j        d         d         dddt          dk    sJ t          j                                        dk    sJ |                                 |j        dk    sJ d S )Nc                   (    e Zd Z G d d          ZdS )Ktest_mutation_with_modelform_djangoforminputtype.<locals>.ReporterInputTypec                       e Zd ZeZeZdZdS )Ptest_mutation_with_modelform_djangoforminputtype.<locals>.ReporterInputType.Metar>   Nr   r   r   r$   rC   r   object_typerD   r   r   r   r   r      s        %J&KAKKKr   r   Nr   r   r   r   rE   r      sF        	B 	B 	B 	B 	B 	B 	B 	B 	B 	Br   rE   c                   X    e Zd Z G  fdd          Z ej        e          ZfdZdS )Jtest_mutation_with_modelform_djangoforminputtype.<locals>.ReporterMutationc                   (    e Zd Z  d          ZdS )Ttest_mutation_with_modelform_djangoforminputtype.<locals>.ReporterMutation.ArgumentsTrr   N)r   r   r   reporter_datarE   s   r   r   r      s"        --t<<<MMMr   r   c                     t           j                            |j                  }t	          ||          }|                                r |                                } |          S  d           S )N)rd   )r   instancer   )r	   objectsgetrF   r$   r   save)r   r   r   reporterr   ReporterMutations        r   r   zQtest_mutation_with_modelform_djangoforminputtype.<locals>.ReporterMutation.mutate   sv    '++}/?+@@H]XFFFD}} 999;;''x8888##40000r   N)	r   r   r   r   rj   r   r   r   r   rE   r   s   r   r   r      ss        	= 	= 	= 	= 	= 	= 	= 	= 	= 	=  --	1 	1 	1 	1 	1 	1 	1r   r   c                   8    e Zd Z                                 ZdS )Btest_mutation_with_modelform_djangoforminputtype.<locals>.MutationNr   r   r   r   report_mutationr   s   r   r   r               *0022r   r   r   BobRobertsr>   a4   mutation ReportMutation($reporterData: ReporterInputType!) {
            reportMutation(reporterData: $reporterData) {
                result {
                    id,
                    firstName,
                    lastName,
                    aChoice
                }
            }
        }
        reporterDataDaveSmith)rF   	firstNamelastNameaChoicer   reportMutationr   1   )r   rj   r   r   r   ry   r	   r   createTHISr   rd   THIS_ON_CLIENT_CONVERTEDr   r   countrefresh_from_dbr?   )r   r   r   r   rE   r   s       @@r   0test_mutation_with_modelform_djangoforminputtyper      s   B B B B B5 B B B1 1 1 1 1 1 1 18, 1 1 13 3 3 3 3 3 38& 3 3 3 _9x@@@F&&I '  H ^^
	 k##3	 
   F* =   ;'(2+	7 7     !!##q((((&((((((r   c                       G  fddt           j                   G fddt           j                  }t          j        t          |          }|                    ddd|ii	          S )
Nc                   t    e Zd Z G  fdd          Z ej                    Z ej                    ZfdZ	dS )?reporter_enum_convert_mutation_result.<locals>.ReporterMutationc                   (    e Zd Z  d          ZdS )Ireporter_enum_convert_mutation_result.<locals>.ReporterMutation.ArgumentsTrr   N)r   r   r   r   r   s   r   r   r      s"        (($777HHHr   r   c                     t          |j        t                    s|j                                        r |j        d           S  d |j                  S )N)
result_int
result_str)
isinstancerA   intisdigit)r   r   r   r   s      r   r   zFreporter_enum_convert_mutation_result.<locals>.ReporterMutation.mutate   sc    (+S11 WX5F5N5N5P5P W''83DQUVVVV##t@QRRRRr   N)
r   r   r   r   rj   rt   r   Intr   r   r   s   r   r   r      s        	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 %X_&&
!X\^^
	S 	S 	S 	S 	S 	S 	Sr   r   c                   8    e Zd Z                                 ZdS )7reporter_enum_convert_mutation_result.<locals>.MutationNr   r   s   r   r   r      r   r   r   r   z mutation ReportMutation($reporter: ReporterInputType!) {
            reportMutation(reporter: $reporter) {
                resultStr,
                resultInt
            }
        }
        r   r   r   )rj   r   r   r   ry   r   )rE   choice_val_on_clientr   r   r   s   `   @r   %reporter_enum_convert_mutation_resultr      s    
S 
S 
S 
S 
S 
S 
S 
S8, 
S 
S 
S3 3 3 3 3 3 38& 3 3 3 _9x@@@F>>	 $i1E%FG  	 	 	r   c                      G d dt                     } t          |           }|j        J |j        d         d         t          k    sJ |j        d         d         J | j        j        d         j        t          j	        u sJ d S )Nc                   (    e Zd Z G d d          ZdS )2test_enum_not_converted.<locals>.ReporterInputTypec                       e Zd ZeZdZdS )7test_enum_not_converted.<locals>.ReporterInputType.MetarA   NrB   r   r   r   r   r      s        %J'KKKr   r   Nr   r   r   r   rE   r      s<        	( 	( 	( 	( 	( 	( 	( 	( 	( 	(r   rE   r   	resultStr	resultIntrA   )
r   r   r   r   r   rJ   r"   ri   rj   rt   rE   r   s     r   test_enum_not_convertedr      s    ( ( ( ( (5 ( ( (
 33DEEF=   ;'(59QQQQQ;'(5===")*5:hoMMMMMMr   c                      G d dt                     } t          |           }|j        J |j        d         d         t          k    sJ |j        d         d         J | j        j        d         j        j        dk    sJ d S )Nc                   (    e Zd Z G d d          ZdS )=test_enum_is_converted_to_original.<locals>.ReporterInputTypec                       e Zd ZeZeZdZdS )Btest_enum_is_converted_to_original.<locals>.ReporterInputType.Metar   Nr   r   r   r   r   r      s        %J&K'KKKr   r   Nr   r   r   r   rE   r      s<        	( 	( 	( 	( 	( 	( 	( 	( 	( 	(r   rE   r   r   r   rA   AChoiceEnumBackConvString)	r   r   r   r   r   rJ   r"   ri   r   r   s     r   "test_enum_is_converted_to_originalr      s    ( ( ( ( (5 ( ( ( 33DEEF=   ;'(5====;'(5===&z27@&	' 	' 	' 	' 	' 	'r   c                  D    G d dt                      G fddt                    } t          | t                    }|j        J |j        d         d         t          k    sJ |j        d         d         J | j        j        d         j        t          j
        u sJ d S )	Nc                   (    e Zd Z G d d          ZdS )gtest_convert_choices_to_enum_is_false_and_field_type_as_in_model.<locals>.ReporterTypeNotConvertChoicesc                       e Zd ZeZdZdZdS )ltest_convert_choices_to_enum_is_false_and_field_type_as_in_model.<locals>.ReporterTypeNotConvertChoices.MetaFr!   N)r   r   r   r	   r   convert_choices_to_enumr"   r   r   r   r   r     s        E&+#FFFr   r   Nr   r   r   r   ReporterTypeNotConvertChoicesr     s<        	 	 	 	 	 	 	 	 	 	r   r   c                   .    e Zd Z G  fdd          ZdS )[test_convert_choices_to_enum_is_false_and_field_type_as_in_model.<locals>.ReporterInputTypec                       e Zd ZeZ ZdZdS )`test_convert_choices_to_enum_is_false_and_field_type_as_in_model.<locals>.ReporterInputType.Metar   N)r   r   r   r$   rC   r   rD   r   s   r   r   r     s        %J7K'KKKr   r   Nr   r   s   r   rE   r     sG        	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(r   rE   r   r   r   rA   )r   r   r   r   r   r   rJ   r"   ri   rj   r   )rE   r   r   s     @r   @test_convert_choices_to_enum_is_false_and_field_type_as_in_modelr    s        (8   ( ( ( ( ( ( (5 ( ( ( 33DdKKF=   ;'(5====;'(5===")*5:hlJJJJJJr   c                       G  fddt           j                   G fddt           j                  }t          j        t          |          }|                    dddt          ii	          S )
Nc                   V    e Zd Z G  fdd          Z ej                    ZfdZdS )7enum_convert_mutation_result_film.<locals>.FilmMutationc                   (    e Zd Z  d          ZdS )Aenum_convert_mutation_result_film.<locals>.FilmMutation.ArgumentsTrr   N)r   r   r   film)FilmInputTypes   r   r   r    s!         =$///DDDr   r   c                 &     |j                   S )Nr   genre)r   r   r  FilmMutations      r   r   z>enum_convert_mutation_result_film.<locals>.FilmMutation.mutate!  s    <tz2222r   N)r   r   r   r   rj   rt   r   r   )r  r  s   r   r  r    sq        	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 !""	3 	3 	3 	3 	3 	3 	3r   r  c                   8    e Zd Z                                 ZdS )3enum_convert_mutation_result_film.<locals>.MutationN)r   r   r   r   film_mutation)r  s   r   r   r  $  s         $**,,r   r   r   z mutation FilmMutation($film: FilmInputType!) {
            filmMutation(film: $film) {
                result
            }
        }
        r  r  r   )rj   r   r   r   ry   r   DOCUMENTARY_ON_CLIENT_CONVERTED)r  r   r   r  s   `  @r   !enum_convert_mutation_result_filmr    s    3 3 3 3 3 3 3 3x( 3 3 3- - - - - - -8& - - - _9x@@@F>>	  '+J!KL    r   c                       G d dt                     } t          |           }|j        J |j        d         d         t          k    sJ d S )Nc                   (    e Zd Z G d d          ZdS )Btest_enum_not_converted_required_non_number.<locals>.FilmInputTypec                       e Zd ZeZdZdS )Gtest_enum_not_converted_required_non_number.<locals>.FilmInputType.Metar
  N)r   r   r   r   rC   rD   r   r   r   r   r  6  s        !J$KKKr   r   Nr   r   r   r   r  r  5  rf   r   r  filmMutationr   )r   r  r   r   r  )r  r   s     r   +test_enum_not_converted_required_non_numberr  4  sn    % % % % %1 % % %
 /}==F=   ;~&x04SSSSSSSr   c                       G d dt                      G fddt                    } t          |           }|j        J |j        d         d         t
          k    sJ d S )Nc                   (    e Zd Z G d d          ZdS )Htest_enum_is_converted_to_original_required_non_number.<locals>.FilmTypec                       e Zd ZeZdZdS )Mtest_enum_is_converted_to_original_required_non_number.<locals>.FilmType.Metar!   N)r   r   r   r   r   r"   r   r   r   r   r  A  s        EFFFr   r   Nr   r   r   r   FilmTyper  @  s<        	 	 	 	 	 	 	 	 	 	r   r  c                   .    e Zd Z G  fdd          ZdS )Mtest_enum_is_converted_to_original_required_non_number.<locals>.FilmInputTypec                       e Zd ZeZ ZdZdS )Rtest_enum_is_converted_to_original_required_non_number.<locals>.FilmInputType.Metar
  N)r   r   r   r   rC   r   rD   r  s   r   r   r"  F  s        !J"K$KKKr   r   Nr   r#  s   r   r  r   E  sG        	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%r   r  r  r   )r   r   r  r   r   DOCUMENTARY)r  r   r  s     @r   6test_enum_is_converted_to_original_required_non_numberr%  ?  s        #   
% % % % % % %1 % % % /}==F=   ;~&x0K??????r   )'djangor   pytestr   rj   graphene_djangor   tests.modelsr   r   r	   typesr   r   r   r$  r  	ModelFormr   r   r$   Formr+   r8   rP   r^   rl   rw   r   ry   r   r   r   r   r   r  r  r  r%  r   r   r   <module>r-     sy                , , , , , , 3 3 3 3 3 3 3 3 3 3 - - - - - - qz!}   "&     u       #   , , , , ,5? , , ,% % % % %UZ % % %
W W WD D DB B BB B B	F 	F 	F    #   $? $? $?N=) =) =)B -E   @
N 
N 
N  "K K K(  4T T T@ @ @ @ @r   