
    wdXj                     t   d Z ddlmZmZm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 ej        d             Z G d	 d
ej                  Z G d dej                  Z G d dej                  Z G d dej                  Z G d dej                  Zd Zd Zd Zd Zd Zd Zd Zd ZdS )z
Test the DataShape parser.
    )absolute_importdivisionprint_functionN)assert_dshape_equal)parse)	coretypes)DataShapeSyntaxErrorc                  (    t          j                    S N)	datashapeTypeSymbolTable     ;lib/python3.11/site-packages/datashape/tests/test_parser.pysymr      s    $&&&r   c                   P    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd ZdS )TestDataShapeParseBasicDTypec                 6    t          j                    | _        d S r   r   r   r   selfs    r   setUpz"TestDataShapeParseBasicDType.setUp       ,..r   c                     |                      t          d| j                  t          j        t          j                             d S )Nbool)assertEqualr   r   ct	DataShapebool_r   s    r   	test_boolz&TestDataShapeParseBasicDType.test_bool   sA    vtx00bh//	1 	1 	1 	1 	1r   c                    |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j	                             |                      t          d| j                  t          d| j                             |                      t          d| j                  t          j        t          j
                             d S )Nint8int16int32int64intintptr)r   r   r   r   r   r"   r#   r$   r%   int_r'   r   s    r   test_signed_integersz1TestDataShapeParseBasicDType.test_signed_integers    s   vtx00bg..	0 	0 	0w11bh//	1 	1 	1w11bh//	1 	1 	1w11bh//	1 	1 	1 	udh//bg..	0 	0 	0 	udh//w11	3 	3 	3x22bi00	2 	2 	2 	2 	2r   c                    |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j	                             d S )Nuint8uint16uint32uint64uintptr)
r   r   r   r   r   r+   r,   r-   r.   r/   r   s    r   test_unsigned_integersz3TestDataShapeParseBasicDType.test_unsigned_integers3   s   w11bh//	1 	1 	1x22bi00	2 	2 	2x22bi00	2 	2 	2x22bi00	2 	2 	2 	y$(33bj11	3 	3 	3 	3 	3r   c                    |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          d| j                             d S )Nfloat16float32float64real)	r   r   r   r   r   r2   r3   r4   r5   r   s    r   
test_floatz'TestDataShapeParseBasicDType.test_floatA   s   y$(33bj11	3 	3 	3y$(33bj11	3 	3 	3y$(33bj11	3 	3 	3 	vtx00bg..	0 	0 	0 	vtx00y$(33	5 	5 	5 	5 	5r   c                     |                      t          d| j                  t          j        t          j                             d S )Nnull)r   r   r   r   r   r8   r   s    r   	test_nullz&TestDataShapeParseBasicDType.test_nullP   6    vtx00",rw2G2GHHHHHr   c                     |                      t          d| j                  t          j        t          j                             d S )Nvoid)r   r   r   r   r   r<   r   s    r   	test_voidz&TestDataShapeParseBasicDType.test_voidS   r:   r   c                     |                      t          d| j                  t          j        t          j                             d S )Nobject)r   r   r   r   r   object_r   s    r   test_objectz(TestDataShapeParseBasicDType.test_objectV   s6    x22BL4L4LMMMMMr   c                    |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          j        t          j                             |                      t          d| j                  t          d| j                             d S )Nzcomplex[float32]zcomplex[float64]complex)r   r   r   r   r   complex_float32complex_float64complex_r   s    r   test_complexz)TestDataShapeParseBasicDType.test_complexY   s    148<<b&899	; 	; 	;148<<b&899	; 	; 	;y$(33bk22	4 	4 	4 	y$(33148<<	> 	> 	> 	> 	>r   c                    |                      t          d| j                  t          j        t          j        t          j                                       |                      t          d| j                  t          j        t          j        t          j                                       |                      t          d| j                  t          j        t          j        d          t          j        d          t          j        t          j                                       |                      t          d| j                  t          j        t          j        d          t          j        d          t          j        t          j                                       |                      t          d| j                  t          j        t          j        d          t          j        t          j        t          j        d          t          j                                                 |                      t          d| j                  t          j        t          j        d          t          j        t          j        t          j        d          t          j                                                 d S )	Nzoption[int32]z?int32z2 * 3 * option[int32]      z2 * 3 * ?int32z2 * option[3 * int32]z2 * ?3 * int32)r   r   r   r   r   Optionr$   Fixedr   s    r   test_optionz(TestDataShapeParseBasicDType.test_optiond   s.   99bi&9&9::	< 	< 	<x22bi&9&9::	< 	< 	<6AAbhqkk28A;;&(i&9&9; ;	< 	< 	< 	/::bhqkk28A;;&(i&9&9; ;	< 	< 	< 	6AAbhqkk&(iRXa[[=?X1G 1G 'H 'HI I	J 	J 	J 	/::bhqkk&(iRXa[[=?X1G 1G 'H 'HI I	J 	J 	J 	J 	Jr   c                    |                      t          j        t          d| j                   |                      t          j        t          d| j                   |                      t          j        t          d| j                   d S )N bootint33assertRaisesr   r	   r   r   r   s    r   
test_raisez'TestDataShapeParseBasicDType.test_raisex   s~    )8TX	/ 	/ 	/)8	3 	3 	3)8$(	4 	4 	4 	4 	4r   N)__name__
__module____qualname__r   r    r)   r0   r6   r9   r=   rA   rG   rM   rT   r   r   r   r   r      s        / / /1 1 12 2 2&3 3 35 5 5I I II I IN N N	> 	> 	>J J J(4 4 4 4 4r   r   c                        e Zd Zd Zd Zd ZdS )TestDataShapeParserDTypeConstrc                     t          j        d          t          j        j        d<   t          j        j        d<   t          j        j        d<   t          j        j        d<   d g fd}|j        d<    fd	} |d
d            |dd            |dd            |dd            |dd            |dd            |dt          j	        t          j                              |dt          j	        t          j        d                                |dg             |dg d            |dg d            |dt          j	        t          j                  t          j	        t          j                  t          j	        t          j                  g            |dd            |dd            |dd            |d d            |d!d            |d"d            |d#t          j	        t          j                              |d$t          j	        t          j        d                                |d%g             |d&g d            |d'g d            |d(t          j	        t          j                  t          j	        t          j                  t          j	        t          j                  g           d S ))NTbarer"   r,   r4   typevarc                 ^                         | d                    d d<   t          j        S )Nr   r   r   r3   )blahexpected_blahr   s    r   _unary_type_constrzRTestDataShapeParserDTypeConstr.test_unary_dtype_constr.<locals>._unary_type_constr   s0    T=#3444#M!:r   unaryc                     |d<                        t          |           t          j        t          j                                                  d         d d           d S )Nr   z+The test unary type constructor did not runr   r   r   r   r3   )ds_strexpectedra   r   r   s     r   assertExpectedParsezSTestDataShapeParserDTypeConstr.test_unary_dtype_constr.<locals>.assertExpectedParse   sn    'M!U63//bj1I1IJJJ ]1-tJL L L L Lr   zunary[0]r   zunary[100000]i zunary["test"]testzunary['test']zunary["\uc548\ub155"]u   안녕u   unary["안녕"]zunary[int8]zunary[X]Xz	unary[[]]zunary[[0, 3, 12]])r   rJ      zunary[["test", "one", "two"]])ri   onetwozunary[[float64, int8, uint16]]zunary[blah=0]zunary[blah=100000]zunary[blah="test"]zunary[blah='test']zunary[blah="\uc548\ub155"]u   unary[blah="안녕"]zunary[blah=int8]zunary[blah=X]zunary[blah=[]]zunary[blah=[0, 3, 12]]z"unary[blah=["test", "one", "two"]]z#unary[blah=[float64, int8, uint16]]
r   r   r   r"   dtyper,   r4   TypeVardtype_constrr   )r   rb   rh   ra   r   s   `  @@r   test_unary_dtype_constrz6TestDataShapeParserDTypeConstr.test_unary_dtype_constr   sb    'T222G	& i	(!z	)&(j#	 	 	 	 	 	 %7!	L 	L 	L 	L 	L 	L 	L 	J***OV444OV444OV4445GGG4oFFFM2<+@+@AAAJRZ__(E(EFFFK,,,/<<<;222	4 	4 	4 	<\"*55r|BG7L7L\")446	7 	7 	7
 	OQ///0&9990&9990&999:OLLL9?KKK.RW0E0EFFFOR\"*S//-J-JKKK,b1114jjjAAA@222	4 	4 	4 	A\"*55r|BG7L7L\")446	7 	7 	7 	7 	7r   c           	          t          j        d          t          j        j        d<   t          j        j        d<   t          j        j        d<   t          j        j        d<   d d g fd}|j        d<    fd	} |d
dd            |ddd            |dt          j	        t          j                  d            |dg dd            |ddd            |ddt          j	        t          j        d                                |dddgt          j	        t          j                              |dt          j	        t          j        d                    ddg            |ddd            |dt          j	        t          j                  t          j	        t          j        d                    t          j	        t          j                  gd           d S )NTr[   r"   r,   r4   r]   c                                          | d                                         |d                    d d<   d d<   t          j        S )Nr      r_   )abexpected_argr   s     r   _binary_type_constrzTTestDataShapeParserDTypeConstr.test_binary_dtype_constr.<locals>._binary_type_constr   sQ    QQ000QQ000"LO"LO:r   binaryc                     |d<   |d<                        t          |           t          j        t          j                                                  d d gd           d S )Nr   ru   z,The test binary type constructor did not runre   )rf   
expected_a
expected_brx   r   r   s      r   rh   zTTestDataShapeParserDTypeConstr.test_binary_dtype_constr.<locals>.assertExpectedParse   su    (LO(LOU63//bj1I1IJJJ \D$<KM M M M Mr   zbinary[1, 0]ru   r   zbinary[0, "test"]ri   zbinary[int8, "test"]zbinary[[1,3,5], "test"])ru   rJ      zbinary[0, b=1]zbinary["test", b=A]Azbinary[[3, 6], b=int8]rJ      zbinary[Arg, b=["x", "test"]]Argxzbinary[a=1, b=0]z"binary[a=[int8, A, uint16], b="x"]rn   )r   ry   rh   rx   r   s   `  @@r   test_binary_dtype_constrz7TestDataShapeParserDTypeConstr.test_binary_dtype_constr   sD    'T222G	& i	(!z	)&(j#d|	 	 	 	 	 	 &9"	M 	M 	M 	M 	M 	M 	M 	NAq111/F;;;2L116	; 	; 	;5yyy&III,a33316LC99	; 	; 	;4q!fL11	3 	3 	3:LE):):;;c6]	L 	L 	L 	.1555@\"'22\"*S//::\")446  		! 	! 	! 	! 	!r   c                    t          j        d          }t          j        |j        d<   t          j        |j        d<   t          j        |j        d<   d }||j        d<   |                     t          t          d|           |                     t          t          d	|           |                     t          t          d
|           |                     t          t          d|           |                     t          t          d|           |                     t          t          d|           |                     t          t          d|           |                     t          t          d|           |                     t          t          d|           |                     t          t          d|           |                     t          t          d|           |                     t          t          d|           d S )NTr[   r"   r,   r4   c                      t           j        S r   )r   r3   )argskwargss     r   _type_constrzMTestDataShapeParserDTypeConstr.test_dtype_constr_errors.<locals>._type_constr  s
    :r   tconztcon[ztcon[]ztcon[unknown]ztcon[x=ztcon[x=]ztcon[x=A, B]ztcon[[0, "x"]]ztcon[[0, X]]ztcon[["x", 0]]ztcon[["x", X]]ztcon[[X, 0]]ztcon[[X, "x"]])r   r   r   r"   ro   r,   r4   rq   rS   r	   r   )r   r   r   s      r   test_dtype_constr_errorsz7TestDataShapeParserDTypeConstr.test_dtype_constr_errors  s    'T222G	& i	(!z	)	 	 	#/  	.#	/ 	/ 	/ 	.3	0 	0 	0 	.#	7 	7 	7 	.C	1 	1 	1.S	2 	2 	2 	.	6 	6 	6 	.!13	8 	8 	8.	6 	6 	6.!13	8 	8 	8.!13	8 	8 	8.	6 	6 	6.!13	8 	8 	8 	8 	8r   N)rU   rV   rW   rr   r   r   r   r   r   rY   rY      sF        H7 H7 H7T3! 3! 3!j+8 +8 +8 +8 +8r   rY   c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )TestDataShapeParserDimsc                 6    t          j                    | _        d S r   r   r   s    r   r   zTestDataShapeParserDims.setUp2  r   r   c                    |                      t          d| j                  t          j        t          j        d          t          j                             |                      t          d| j                  t          j        t          j        d          t          j        d          t          j                             |                      t          d| j                  t          j        t          j        d          t          j        d          t          j        d          t          j                             |                      t          d| j                  t          j        t          j        d	          t          j        d          t          j        d
          t          j        d          t          j                             d S )Nz3 * boolrJ   z7 * 3 * bool   z5 * 3 * 12 * boolr~   rk   z2 * 3 * 4 * 5 * boolrI      )r   r   r   r   r   rL   r   r   s    r   test_fixed_dimsz'TestDataShapeParserDims.test_fixed_dims6  s\   z4844bhqkk28<<	> 	> 	>~tx88bhqkk28A;;II	K 	K 	K2DH==bhqkk28A;;&(hrllBH> >	? 	? 	? 	5tx@@bhqkk28A;;&(hqkk28A;;J J	K 	K 	K 	K 	Kr   c           
         |                      t          d| j                  t          j        t          j        d          t          j                             |                      t          d| j                  t          j        t          j        d          t          j        d          t          j                             |                      t          d| j                  t          j        t          j        t          j        d                    t          j        d          t          j        d          t          j                             d S )	NzM * boolMzA * B * boolr   BzA... * X * 3 * boolrj   rJ   )	r   r   r   r   r   rp   r   EllipsisrL   r   s    r   test_typevar_dimsz)TestDataShapeParserDims.test_typevar_dimsB  s    z4844bjoorx@@	B 	B 	B~tx88bjoorz#QQ	S 	S 	S4dh??bk"*S//&B&BBJsOO&(hqkk28= =	> 	> 	> 	> 	>r   c           	         |                      t          d| j                  t          j        t          j                    t          j                             |                      t          d| j                  t          j        t          j                    t          j                    t          j                             |                      t          d| j                  t          j        t          j        d          t          j        d          t          j                    t          j                             d S )Nz
var * boolzvar * var * boolzM * 5 * var * boolr   r~   )	r   r   r   r   r   Varr   rp   rL   r   s    r   test_var_dimsz%TestDataShapeParserDims.test_var_dimsK  s    |TX66bfhh99	; 	; 	;148<<bfhh"(CC	E 	E 	E3TX>>bjoorx{{BFHHbhWW	Y 	Y 	Y 	Y 	Yr   c           
         |                      t          d| j                  t          j        t          j                    t          j                             |                      t          d| j                  t          j        t          j        d          t          j                    t          j                             |                      t          d| j                  t          j        t          j        d          t          j                    t          j        d          t          j                             d S )Nz
... * boolzM * ... * boolr   zM * ... * 3 * boolrJ   )	r   r   r   r   r   r   r   rp   rL   r   s    r   test_ellipsesz%TestDataShapeParserDims.test_ellipsesS  s    |TX66bkmmRX>>	@ 	@ 	@/::bjoor{}}bhOO	Q 	Q 	Q3TX>>bjoor{}}&(hqkk28= =	> 	> 	> 	> 	>r   N)rU   rV   rW   r   r   r   r   r   r   r   r   r   r   0  se        / / /
K 
K 
K> > >Y Y Y> > > > >r   r   c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )TestDataShapeParseStructc                 6    t          j                    | _        d S r   r   r   s    r   r   zTestDataShapeParseStruct.setUp_  r   r   c                    |                      t          d| j                  t          j        t          j        dt          j        t          j                  fdt          j        t          j                  fg                               |                      t          d| j                  t          j        t          j        dt          j        t          j                  fdt          j        t          j                  fg                               |                      t          d| j                  t          j        t          j        dt          j        t          j                  fdt          j        t          j                  fg                               d}t          j        t          j                  }t          j        t          j                  }t          j        t          j	                  }t          j
        d	          t          j                    t          j        d
|fd|fdt          j        t          j        d|fd|fg                    fdt          j        t          j                    t          j        d|fd|fg                    fg          f}|                      t          || j                  t          j        |            d S )Nz{x: int16, y: int32}r   yz{x: int16, y: int32,}z{_x: int16, Zed: int32,}_xZeda  3 * var * {
                        id : int32,
                        name : string,
                        description : {
                            language : string,
                            text : string
                        },
                        entries : var * {
                            date : date,
                            text : string
                        }
                    }rJ   idnamedescriptionlanguagetextentriesdate)r   r   r   r   r   Recordr#   r$   stringdate_rL   r   )r   rf   r$   r   r   dss         r   test_structz$TestDataShapeParseStruct.test_structc  s   5tx@@bi#r|BH7M7M1N25r|BH7M7M1N1P 'Q 'Q R R	S 	S 	S 	6AAbi#r|BH7M7M1N25r|BH7M7M1N1P 'Q 'Q R R	S 	S 	S 	948DDbi$RX8N8N1O27bh9O9O1P1R 'S 'S T T	U 	U 	U RX&&bi((|BH%%hqkk2688i$ &)'bi*fAUBH&AQAS 7T 7T *U *U V#R\"&((24)fd^>Df=M=O 3P 3P&Q &Q R	S T TU 	vtx00",2CDDDDDr   c                     t          d| j                  }|                     t          |d                   t          j                   |                     t          |d         j                  d           d S )Na  {
                type: bool,
                data: bool,
                blob: bool,
                bool: bool,
                int: int32,
                float: float32,
                double: float64,
                int8: int8,
                int16: int16,
                int32: int32,
                int64: int64,
                uint8: uint8,
                uint16: uint16,
                uint32: uint32,
                uint64: uint64,
                float16: float32,
                float32: float32,
                float64: float64,
                float128: float64,
                complex: float32,
                complex64: float32,
                complex128: float64,
                string: string,
                object: string,
                datetime: string,
                datetime64: string,
                timedelta: string,
                timedelta64: string,
                json: string,
                var: string,
            }   r   r   r   typer   r   lennamesr   r   s     r   test_fields_with_dshape_namesz6TestDataShapeParseStruct.test_fields_with_dshape_names  sl     > (? @ 	bfry111RV\**B/////r   c                     t          d| j                  }|                     t          |d                   t          j                   |                     t          |d         j                  d           d S )Na	  5 * var * {
              id: int64,
              name: string,
              description: {
                languages: var * string[2],
                texts: json,
              },
              status: string,
              funded_amount: float64,
              basket_amount: json,
              paid_amount: json,
              image: {
                id: int64,
                template_id: int64,
              },
              video: json,
              activity: string,
              sector: string,
              use: string,
              delinquent: bool,
              location: {
                country_code: string[2],
                country: string,
                town: json,
                geo: {
                  level: string,
                  pairs: string,
                  type: string,
                },
              },
              partner_id: int64,
              posted_date: json,
              planned_expiration_date: json,
              loan_amount: float64,
              currency_exchange_loss_amount: json,
              borrowers: var * {
                first_name: string,
                last_name: string,
                gender: string[1],
                pictured: bool,
              },
              terms: {
                disbursal_date: json,
                disbursal_currency: string[3,'A'],
                disbursal_amount: float64,
                loan_amount: float64,
                local_payments: var * {
                  due_date: json,
                  amount: float64,
                },
                scheduled_payments: var * {
                  due_date: json,
                  amount: float64,
                },
                loss_liability: {
                  nonpayment: string,
                  currency_exchange: string,
                  currency_exchange_coverage_rate: json,
                },
              },
              payments: var * {
                amount: float64,
                local_amount: float64,
                processed_date: json,
                settlement_date: json,
                rounded_local_amount: float64,
                currency_exchange_loss_amount: float64,
                payment_id: int64,
                comment: json,
              },
              funded_date: json,
              paid_date: json,
              journal_totals: {
                entries: int64,
                bulkEntries: int64,
              },
            }
        r      r   r   s     r   test_kiva_datashapez,TestDataShapeParseStruct.test_kiva_datashape  sq     MZ X[M M\ 	bfry111RV\**B/////r   c                    t          d| j                  }|                     t          |d         j                  d           t          d| j                  }|                     t          |d         j                  d           d S )Nzp5 * var * {
              id: int64,
             'my field': string,
              name: string }
             r   rJ   z2 * var * {
             "AASD @#$@#$ ' sdf": string,
              id: float32,
              id2: int64,
              name: string }
             r   )r   r   r   r   r   r   s     r   test_strings_in_dsz+TestDataShapeParseStruct.test_strings_in_ds  s      (	 
 	RV\**A... 
 (  	RV\**A.....r   c                    |                      t          j        t          d| j                   |                      t          j        t          d| j                   |                      t          j        t          d| j                   |                      t          j        t          d| j                   |                      t          j        t          d| j                   |                      t          j        t          d| j                   d S )Nz-{id: int64, name: string amount: invalidtype}z.{id: int64, name: string, amount: invalidtype}z${id: int64, name: string, amount: %}z7{
   id: int64;
   name: string;
   amount+ float32;
}
z?{
   id: int64;
   'my field 1': string;
   amount+ float32;
}
z?{
   id: int64,
   u'my field 1': string,
   amount: float32
}
rR   r   s    r   test_struct_errorsz+TestDataShapeParseStruct.test_struct_errors  s   )8I(	$ 	$ 	$ 	)8J(	$ 	$ 	$ 	)8@(	$ 	$ 	$ 	)8 
 (	$ 	$ 	$ 	)8 
 (	$ 	$ 	$ 	)8 
 (	$ 	$ 	$ 	$ 	$r   N)	rU   rV   rW   r   r   r   r   r   r   r   r   r   r   r   ]  sw        / / /%E %E %EN#0 #0 #0JQ0 Q0 Q0f/ / / %$ %$ %$ %$ %$r   r   c                       e Zd Zd Zd ZdS )TestDataShapeParseTuplec                 6    t          j                    | _        d S r   r   r   s    r   r   zTestDataShapeParseTuple.setUp<  r   r   c                    |                      t          d| j                  t          j        t          j        t          j        t          j                  g                               |                      t          d| j                  t          j        t          j        t          j        t          j                  t          j        t          j                  g                               |                      t          d| j                  t          j        t          j        t          j        t          j                  g                               |                      t          d| j                  t          j        t          j        t          j        t          j                  t          j        t          j                  g                               d S )Nz	(float32)z(int16, int32)z
(float32,)z(int16, int32,))	r   r   r   r   r   Tupler3   r#   r$   r   s    r   
test_tuplez"TestDataShapeParseTuple.test_tuple@  s   {DH55bhRZ0H0H/I&J&JKK	M 	M 	M/::bhRX0F0F02RX0F0F0H 'I 'I J J	K 	K 	K 	|TX66bhRZ0H0H/I&J&JKK	M 	M 	M0$(;;bhRX0F0F02RX0F0F0H 'I 'I J J	K 	K 	K 	K 	Kr   N)rU   rV   rW   r   r   r   r   r   r   r   :  s7        / / /K K K K Kr   r   c                    t          d|           t          j        t          j        t          j        t          j                  t          j        t          j                                      k    sJ t          d|           t          j        t          j        t          j        t          j                  t          j        t          j                  t          j        t          j                                      k    sJ t          d|           t          j        t          j        t          j        t          j                  t          j        t          j                                      k    sJ t          t          d|           t          j        t          j        t          j        t          j                  t          j        t          j                  t          j        t          j                                                 t          t          d|           t          j        t          j        t          j        t          j                                                 d S )Nz(float32) -> float64z(int16, int32) -> boolz(float32,) -> float64z(int16, int32,) -> boolz
() -> bool)
r   r   r   Functionr3   r4   r#   r$   r   r   r   s    r   test_funcprotor   O  s   (#..LR\"*%=%=%'\"*%=%=? ? @ @@ A A A *C00LR\"(%;%;%'\"(%;%;%'\"(%;%;= = > >> ? ? ?
 )3//LR\"*%=%=%'\"*%=%=? ? @ @@ A A A '--
R[L""L""L""
 
 	 	   lC  
R[L""
 
 	 	    r   c                     t          j        t                    5  t          d|            d d d            d S # 1 swxY w Y   d S )Nz(int64, int32) ->pytestraisesr	   r   r   s    r   test_funcproto_no_return_typer   n  s    	+	,	, ( (!3'''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (   8<<c                     t          d|           }t          |t          j                  sJ t          |j        t          j                  sJ |j        j        dk    sJ d S )Nz()r   )r   
isinstancer   r   measurer   dshapes)r   ts     r   test_empty_tupler   s  s_    dCAa&&&&&ai*****9""""""r   c                     t          j        t                    5  t          d|            d d d            d S # 1 swxY w Y   d S )Nz(int64r   r   s    r   test_no_right_paren_tupler   z  s    	+	,	,  h                 r   c                     t          j        t                    5  t          d|            d d d            d S # 1 swxY w Y   d S )Nz
int64,asdfr   r   s    r   test_garbage_at_endr     s    	+	,	, ! !lC   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !r   c                    t          j        t                    5  t          d|            d d d            n# 1 swxY w Y   t          j        t                    5  t          d|            d d d            d S # 1 swxY w Y   d S )Nzstring[10,[z
string[10,r   r   s    r   test_type_constructor_failr     s    	+	,	, " "mS!!!" " " " " " " " " " " " " " " 
+	,	, ! !lC   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !   7;;A99A= A=c                    t          j        t                    5  t          d|            d d d            n# 1 swxY w Y   t          j        t                    5  t          d|            d d d            d S # 1 swxY w Y   d S )Nzfixed[10] * var * stringzfixed[10 * var * string)r   r   NotImplementedErrorr   r	   r   s    r   test_dim_constructor_failr     s    	*	+	+ / /(#.../ / / / / / / / / / / / / / /	+	,	, . .'---. . . . . . . . . . . . . . . . . .r   c                     t          j        t                    5  t          d|            d d d            d S # 1 swxY w Y   d S )Nz10 * foo[10]r   r   s    r   test_invalid_dtyper     s    	+	,	, # #nc"""# # # # # # # # # # # # # # # # # #r   )__doc__
__future__r   r   r   unittestr   r   datashape.util.testingr   datashape.parserr   r   r   r	   fixturer   TestCaser   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s:    A @ @ @ @ @ @ @ @ @       6 6 6 6 6 6 " " " " " " % % % % % % * * * * * * ' ' 'h4 h4 h4 h4 h48#4 h4 h4 h4Vl8 l8 l8 l8 l8X%6 l8 l8 l8^*> *> *> *> *>h/ *> *> *>ZZ$ Z$ Z$ Z$ Z$x0 Z$ Z$ Z$zK K K K Kh/ K K K*  >( ( (
# # #  
! ! !
! ! !. . .# # # # #r   