
    d                     v    d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	  G d d	e          Z
 G d
 de          ZdS )zTests for dulwich.graph.    )TestCase   )
_find_lcascan_fast_forward)
MemoryRepo   )make_commitc                   N    e Zd Zed             Zd Zd Zd Zd Zd Z	d Z
d Zd	S )
FindMergeBaseTestsc                 n      fd}|d         }|dd          }t          t          |||                    S )Nc                     |          S N )	commit_iddags    \/home/feoh/.local/pipx/venvs/poetry/lib/python3.11/site-packages/dulwich/tests/test_graph.pylookup_parentsz3FindMergeBaseTests.run_test.<locals>.lookup_parents!   s    y>!    r   r   )setr   )r   inputsr   c1c2ss   `    r   run_testzFindMergeBaseTests.run_test   sN    	" 	" 	" 	" 	" AYQRRj:nb#66777r   c                     ddgddgdgdgg g d}|                      |                     |ddg          ddh           d S )N1230)54r   r   r   r   r    r   assertEqualr   selfgraphs     r   test_multiple_lcaz$FindMergeBaseTests.test_multiple_lca(   sb     ss
 
 	usCj99C:FFFFFr   c                     dgdgg dgg d}|                      |                     |ddg          t                                 d S )Nr   r   r   )r    r   r   r   r   r    r   )r"   r   r   r#   s     r   test_no_common_ancestorz*FindMergeBaseTests.test_no_common_ancestor4   sY     
 
 	usCj99355AAAAAr   c                     ddgdgdgdgdgdgg d}|                      |                     |ddg          dh           d S NDFECBAGr,   r+   r.   r-   r/   r0   r!   r#   s     r   test_ancestorz FindMergeBaseTests.test_ancestor?   e     s
 
 	usCj99C5AAAAAr   c                     ddgdgdgdgdgdgg d}|                      |                     |ddg          dh           d S )	Nr+   r,   r-   r.   r/   r0   r1   r2   r!   r#   s     r   test_direct_parentz%FindMergeBaseTests.test_direct_parentL   r4   r   c                     ddgddgddgdgdgdgg d}|                      |                     |ddg          ddh           d S r*   r!   r#   s     r   test_another_crossoverz)FindMergeBaseTests.test_another_crossoverY   sk     sss
 
 	usCj99C:FFFFFr   c                     dgdgdgdgdgdgdgdgd	gd
gdgdgd	gdgg d}|                      |                     |g d          d	h           d S )NC1C2C3C4r   B1B2B3r   A1A2A3r.   r:   r;   r<   r=   r/   r>   r?   r@   r0   rA   rB   rC   r   r   )r0   r/   r.   r!   r#   s     r   test_three_way_merge_lcaz+FindMergeBaseTests.test_three_way_merge_lcaf   s     &&&%&&%&&%
 
& 	uooo>>FFFFFr   c                 "   dgdgdgdgdgdgdgdgd	gd
gdgdgd	gdgg dfd}dg}ddg}|D ]:}g }|D ])}t          |||g          }|                    |           *|d d          };|                     t          |          dh           d S )Nr:   r;   r<   r=   r   r>   r?   r@   r   rA   rB   rC   rD   c                     |          S r   r   )cidr%   s    r   r   z7FindMergeBaseTests.test_octopus.<locals>.lookup_parents   s    :r   r0   r/   r.   )r   extendr"   r   )	r$   r   lcasotherscmt	next_lcascaresr%   s	           @r   test_octopuszFindMergeBaseTests.test_octopus}   s   
 &&&%&&%&&%
 
$	 	 	 	 	 us 	  	 CI & & rd;;  %%%%QQQ<DDTSE*****r   N)__name__
__module____qualname__staticmethodr   r&   r(   r3   r6   r8   rE   rP   r   r   r   r   r      s        8 8 \8
G 
G 
G	B 	B 	BB B BB B BG G GG G G.!+ !+ !+ !+ !+r   r   c                       e Zd Zd Zd ZdS )CanFastForwardTestsc                 L   t                      }t                      }t          |j        g          }t          |j        g          }|j                            |d f|d f|d fg           |                     t          ||j        |j                             |                     t          ||j        |j                             |                     t          ||j        |j                             |                     t          ||j        |j                             d S )Nparentsr   r	   idobject_storeadd_objects
assertTruer   assertFalse)r$   rbaser   c2s        r   test_ffzCanFastForwardTests.test_ff   s    LL}}$'+++"%)))	""T4L2t*r4j#IJJJ(BE2599:::(DGRU;;<<<(BE2599:::)!RUBE::;;;;;r   c                    t                      }t                      }t          |j        g          }t          |j        gd          }t          |j        gd          }|j                            |d f|d f|d f|d fg           |                     t          ||j        |j                             |                     t          ||j        |j                             |                     t          ||j        |j                             |                     t          ||j        |j                             d S )NrX   s   2a)rY   messages   2brZ   )r$   r`   ra   r   c2ac2bs         r   test_divergedz!CanFastForwardTests.test_diverged   s   LL}}$'+++25'599925'5999	""T4L2t*sDkCQU;#WXXX(BE36::;;;(BE36::;;;)!SVSV<<===)!SVSV<<=====r   N)rQ   rR   rS   rc   rh   r   r   r   rV   rV      s2        	< 	< 	<
> 
> 
> 
> 
>r   rV   N)__doc__dulwich.testsr   r%   r   r   repor   utilsr	   r   rV   r   r   r   <module>rm      s   *   " " " " " " 0 0 0 0 0 0 0 0            @+ @+ @+ @+ @+ @+ @+ @+F> > > > >( > > > > >r   