o
    tBh                     @  st   d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
mZ ddlmZ ddlmZmZmZ G dd	 d	e
Zd
S )z<Test cases for the constraint solver used in type inference.    )annotations)
SUBTYPE_OFSUPERTYPE_OF
Constraint)solve_constraints)Suiteassert_equal)TypeFixture)Type	TypeVarIdTypeVarTypec                   @  s   e Zd Zd+ddZd+ddZd+ddZd+d	d
Zd+ddZd+ddZd+ddZ	d+ddZ
d+ddZd+ddZd+ddZd,dd Zd-d&d'Zd-d(d)Zd*S ).
SolveSuitereturnNonec                 C  s   t  | _d S N)r	   fxself r   j/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/mypy/test/testsolve.pysetUp   s   zSolveSuite.setUpc                 C  s   |  g g g  d S r   )assert_solver   r   r   r   test_empty_input   s   zSolveSuite.test_empty_inputc                 C  s   |  | jjjg| | jj| jjg| jj| jjfg |  | jjjg| | jj| jj| | jj| jjg| jj| jjfg d S r   )r   r   tidsupcaobr   r   r   r   !test_simple_supertype_constraints   s   .
&z,SolveSuite.test_simple_supertype_constraintsc                 C  sr   |  | jjjg| | jj| jjg| jjg |  | jjjg| | jj| jj| | jj| jjg| jjg d S r   )r   r   r   r   subcr   r   r   r   r   r   test_simple_subtype_constraints   s   .
&z*SolveSuite.test_simple_subtype_constraintsc                 C  sL   |  | jjjg| | jj| jj| | jj| jjg| jj| jjfg d S r   )r   r   r   r   r   r   r    r   r   r   r   r   test_both_kinds_of_constraints%   
   
&z)SolveSuite.test_both_kinds_of_constraintsc                 C  s@   |  | jjjg| | jj| jj| | jj| jjgd g d S r   )r   r   r   r   r   r   r    r   r   r   r   r   test_unsatisfiable_constraints,   s
   
&z)SolveSuite.test_unsatisfiable_constraintsc                 C  sL   |  | jjjg| | jj| jj| | jj| jjg| jj| jjfg d S r   )r   r   r   r   r   r   r    r   r   r   r   test_exactly_specified_result4   r#   z(SolveSuite.test_exactly_specified_resultc              	   C  st   |  | jjj| jjjg| | jj| jj| | jj| jj| | jj| jj	g| jj| jj	f| jj| jj
fg d S r   )r   r   r   r   sr   r   cr    r   r   r   r   r   r   test_multiple_variables;   s   z"SolveSuite.test_multiple_variablesc                 C  s   |  | jjjgg | jjg |  | jjj| jjjgg | jj| jjg |  | jjj| jjjg| | jj| jjg| jj| jj| jjfg d S r   )	r   r   r   r   uninhabitedr&   r   r   r   r   r   r   r   test_no_constraints_for_varF   s   "z&SolveSuite.test_no_constraints_for_varc                 C  sH  |  | jjjg| | jj| jjg| jj| jjfg |  | jjjg| | jj| jj| | jj| jjg| jj| jjfg |  | jjjg| | jj| jj| | jj| jjg| jj| jjfg |  | jjjg| | jj| jjg| jj| jjfg |  | jjjg| | jj| jj| | jj| jjg| jj| jjfg d S r   )r   r   r   r   r   anytr   r    r   r   r   r   )test_simple_constraints_with_dynamic_typeQ   s*   .
&
&.
&z4SolveSuite.test_simple_constraints_with_dynamic_typec                 C  s   |  | jjjg| | jj| jj| | jj| jjg| jj| jjfg |  | jjjg| | jj| jj| | jj| jjg| jj| jjfg d S r   )r   r   r   r   r   r   r    r+   r   r   r   r   )test_both_normal_and_any_types_in_resultsn   s   
&
&z4SolveSuite.test_both_normal_and_any_types_in_resultsvarslist[TypeVarId]constraintslist[Constraint]results%list[None | Type | tuple[Type, Type]]c                 C  sR   g }|D ]}t |tr||d  q|| qt||}tt|t| d S )Nr   )
isinstancetupleappendr   r   str)r   r.   r0   r2   resractualr   r   r   r   }   s   

zSolveSuite.assert_solvetype_varr   boundr
   r   c                 C     t |jt|S r   )r   r   r   r   r;   r<   r   r   r   r         zSolveSuite.supcc                 C  r=   r   )r   r   r   r>   r   r   r   r       r?   zSolveSuite.subcN)r   r   )r.   r/   r0   r1   r2   r3   r   r   )r;   r   r<   r
   r   r   )__name__
__module____qualname__r   r   r   r!   r"   r$   r%   r(   r*   r,   r-   r   r   r    r   r   r   r   r      s    













r   N)__doc__
__future__r   mypy.constraintsr   r   r   
mypy.solver   mypy.test.helpersr   r   mypy.test.typefixturer	   
mypy.typesr
   r   r   r   r   r   r   r   <module>   s    