o
    _~#g                     @   sx   d dl Zd dlZd dlmZmZ d dlmZ G dd dZ	G dd de	Z
G dd de	Zejd	g d
dd ZdS )    N)	DataFrameSeriesc                   @   s   e Zd Zejdd ZejdefddZejdefddZe	dd	 Z
d
d Zdd Zdd Zdd Zdd Zdd Zdd Zdd ZdS )DotSharedTestsc                 C      t NNotImplementedErrorself r   /var/www/static.ux5.de/https/Moving-Object-Detection-with-OpenCV/env/lib/python3.10/site-packages/pandas/tests/frame/methods/test_dot.pyobj   s   zDotSharedTests.objreturnc                 C   r   )zV
        other is a DataFrame that is indexed so that obj.dot(other) is valid
        r   r	   r   r   r   other      zDotSharedTests.otherc                 C   r   )z7
        The expected result of obj.dot(other)
        r   r
   r   r   r   r   r   expected   r   zDotSharedTests.expectedc                 C   r   )N
        Assertion about results with 1 fewer dimension that self.obj
        r   clsresultr   r   r   r   reduced_dim_assert   r   z!DotSharedTests.reduced_dim_assertc                 C   s   | |}t|| d S r   )dottmassert_equalr
   r   r   r   r   r   r   r   test_dot_equiv_values_dot%   s   
z(DotSharedTests.test_dot_equiv_values_dotc                 C   s$   | |j}t||jksJ d S r   )r   valuesnpallr   r   r   r   test_dot_2d_ndarray*   s   z"DotSharedTests.test_dot_2d_ndarrayc                 C   s>   |j dkr
|jd n|}||j}||}| || d S )N   r   )ndimilocr   r   r   )r
   r   r   rowr   r   r   r   test_dot_1d_ndarray0   s   
z"DotSharedTests.test_dot_1d_ndarrayc                 C   s"   | |d }| ||d  d S )N1)r   r   r   r   r   r   test_dot_series8   s   zDotSharedTests.test_dot_seriesc                 C   s.   | |jd d d d }| ||d  d S )Nr&   )r   r#   r   r   r   r   r   test_dot_series_alignment=   s   z(DotSharedTests.test_dot_series_alignmentc                 C   s*   |j d d d }||}t|| d S )Nr(   )r#   r   r   r   )r
   r   r   r   other2r   r   r   r   test_dot_alignsA   s   
zDotSharedTests.test_dot_alignsc                 C   sL   d}t jt|d ||jd d  W d    d S 1 sw   Y  d S )NzDot product shape mismatchmatch   )pytestraises	Exceptionr   r   )r
   r   msgr   r   r   test_dot_shape_mismatchG   s   "z&DotSharedTests.test_dot_shape_mismatchc                 C   sD   d}t jt|d ||j W d    d S 1 sw   Y  d S )Nzmatrices are not alignedr,   )r/   r0   
ValueErrorr   T)r
   r   r   r2   r   r   r   test_dot_misalignedM   s   "z"DotSharedTests.test_dot_misalignedN)__name__
__module____qualname__r/   fixturer   r   r   r   classmethodr   r   r    r%   r'   r)   r+   r3   r6   r   r   r   r   r      s"    

r   c                   @   B   e Zd Zejdd Zejdd Zejdd Zedd Z	d	S )
TestSeriesDotc                 C   s   t tjddg ddS )Nr!      pqrsindex)r   r   randomdefault_rngstandard_normalr	   r   r   r   r   T      zTestSeriesDot.objc                 C   s&   t tjddg dg ddjS )Nr!   r.   r>   )r&   23r?   rE   columns)r   r   rF   rG   rH   r5   r	   r   r   r   r   Z   s   zTestSeriesDot.otherc                 C   s   t t|j|j|jdS )NrD   )r   r   r   r   rN   r   r   r   r   r   b   s   zTestSeriesDot.expectedc                 C   s   t || dS )r   N)r   assert_almost_equalr   r   r   r   r   f   s   z TestSeriesDot.reduced_dim_assertN
r7   r8   r9   r/   r:   r   r   r   r;   r   r   r   r   r   r=   S   s    


r=   c                   @   r<   )
TestDataFrameDotc                 C   s$   t tjddg dg ddS )Nr!   rJ   )abcr?   rM   r   r   rF   rG   rH   r	   r   r   r   r   o   
   zTestDataFrameDot.objc                 C   s$   t tjddg dddgdS )Nr!   )r>   r!   r?   r&   rK   rM   rU   r	   r   r   r   r   w   rV   zTestDataFrameDot.otherc                 C   s   t t|j|j|j|jdS )NrM   )r   r   r   r   rE   rN   r   r   r   r   r      rI   zTestDataFrameDot.expectedc                 C   s"   t j||dd |jdu sJ dS )r   F)check_namesN)r   assert_series_equalnamer   r   r   r   r      s   z#TestDataFrameDot.reduced_dim_assertNrP   r   r   r   r   rQ   n   s    


rQ   zdtype,exp_dtype))Float32Float64)Int16Int32)zfloat[pyarrow]zdouble[pyarrow]c                 C   s   t d ddg}tddgddgdd	gg|d
d}tddgddgg|| d}||}tddgddgdd	gg|d}t|| d S )NpyarrowrR   rS      r!   r.   r>         int32)rN   dtyper   )rE   rc   )rc   )r/   importorskipr   r   r   assert_frame_equal)rc   	exp_dtypecolsdf_adf_br   r   r   r   r   test_arrow_dtype   s   
 
rj   )numpyr   r/   pandasr   r   pandas._testing_testingr   r   r=   rQ   markparametrizerj   r   r   r   r   <module>   s    H 