Ë
   8dàú/šŒã                   ój   — d dl Zd dlmc mZ d dlmZ d dlm	Z	 dZ
d„ Zd„ Zd„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zy)é    N)ÚPath)Úpaths)ÚCB26_CONFIG_DIRÚCB26_DATA_DIRÚCB26_WORKSPACE_DIRÚCB26_CONVERSATIONS_DIRÚCB26_CHROMA_DIRÚCB26_LOGS_DIRÚCB26_CACHE_DIRc                 ó@   — t         D ]  }| j                  |d¬«       Œ y )NF)Úraising)ÚALL_CB26_ENVÚdelenv)ÚmonkeypatchÚks     ú2/home/oem/CyberBrain26-unified/tests/test_paths.pyÚ_clear_cb26_envr      s$   € Üò -ˆØ×Ñ˜1 eÐÕ,ñ-ó    c           
      ó¶  — t        | «       d}t        j                  } |«       }t        |«      }||v }|�s&t	        j
                  d|fd||f«      t	        j                  |«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      nddt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}x}x}}d}t        j                  } |«       }t        |«      }||v }|�s&t	        j
                  d|fd	||f«      t	        j                  |«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      nddt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}x}x}}t        j                  } |«       }	|	j                  }t        j                  } |«       }
||
k(  }|�s:t	        j
                  d
|fd||
f«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |	«      t	        j                  |«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |
«      dœz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}	x}x}x}}
t        j                  } |«       }	|	j                  }t        j                  } |«       }
||
k(  }|�s:t	        j
                  d
|fd||
f«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |	«      t	        j                  |«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |
«      dœz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}	x}x}x}}
t        j                   } |«       }	|	j                  }t        j                  } |«       }
||
k(  }|�s:t	        j
                  d
|fd||
f«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |	«      t	        j                  |«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |
«      dœz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}	x}x}x}}
y )NÚcyberbrain26)Úin)zi%(py1)s in %(py10)s
{%(py10)s = %(py3)s(%(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s.config_dir
}()
})
}Ústrr   )Úpy1Úpy3Úpy4Úpy6Úpy8Úpy10zassert %(py12)sÚpy12)zg%(py1)s in %(py10)s
{%(py10)s = %(py3)s(%(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s.data_dir
}()
})
}©ú==)z¡%(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.workspace_dir
}()
}.parent
} == %(py12)s
{%(py12)s = %(py10)s
{%(py10)s = %(py8)s.data_dir
}()
})Úpy0Úpy2r   r   r   r   r   úassert %(py14)sÚpy14)z¥%(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.conversations_dir
}()
}.parent
} == %(py12)s
{%(py12)s = %(py10)s
{%(py10)s = %(py8)s.data_dir
}()
})z£%(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.chroma_dir
}()
}.parent
} == %(py12)s
{%(py12)s = %(py10)s
{%(py10)s = %(py8)s.workspace_dir
}()
})r   r   Ú
config_dirr   Ú
@pytest_arÚ_call_reprcompareÚ	_safereprÚ@py_builtinsÚlocalsÚ_should_repr_global_nameÚAssertionErrorÚ_format_explanationÚdata_dirÚworkspace_dirÚparentÚconversations_dirÚ
chroma_dir)r   Ú@py_assert0Ú@py_assert5Ú@py_assert7Ú@py_assert9Ú@py_assert2Ú@py_format11Ú@py_format13Ú@py_assert1Ú@py_assert3Ú@py_assert11Ú@py_format15s               r   Útest_default_paths_use_xdgr?      s  € Ü�KÔ ØÐ4¤×!1Ñ!1Ð4Ñ!1Ó!3Ð4œSÐ!3Ó4Ð4ˆ>Ð4Ð4×4×4Ö4ˆ>Ð4×4×4Ó4ˆ>×4×4×4×4×4Ð4œS×4×4Ó4œS×4×4×4×4×4Ò4¤×4×4Ó4¤×4×4Ô4Ð!1×4×4Ò4Ð!3×4×4Ò4Ð4×4×4×4×4×4×4×4ØÐ2¤§¡Ð2¡Ó!1Ð2œSÐ!1Ó2Ð2ˆ>Ð2Ð2×2×2Ö2ˆ>Ð2×2×2Ó2ˆ>×2×2×2×2×2Ð2œS×2×2Ó2œS×2×2×2×2×2Ò2¤×2×2Ó2¤×2×2Ô2 ×2×2Ò2Ð!1×2×2Ò2Ð2×2×2×2×2×2×2×2Ü×ÑÐ;ÑÓ Ð;Ð ×'Ñ'Ð;¬5¯>©>Ð;©>Ó+;Ð;Ð'Ð+;Ñ;×;×;Ö;Ð'Ð+;×;×;×;×;×;Ñ;Œ5×;×;Ó;Œ5×;×;Ô;Ð×;×;Ò;Ð ×;×;Ò;Ð'×;×;×;×;×;Ð;¬5×;×;Ó;¬5×;×;Ô;¨>×;×;Ò;Ð+;×;×;×;×;×;×;×;Ñ;Ü×"Ñ"Ð?Ñ"Ó$Ð?Ð$×+Ñ+Ð?¬u¯~©~Ð?©~Ó/?Ð?Ð+Ð/?Ñ?×?×?Ö?Ð+Ð/?×?×?×?×?×?Ñ?Œ5×?×?Ó?Œ5×?×?Ô?Ð"×?×?Ò?Ð$×?×?Ò?Ð+×?×?×?×?×?Ð?¬u×?×?Ó?¬u×?×?Ô?¨~×?×?Ò?Ð/?×?×?×?×?×?×?×?Ñ?Ü×ÑÐ=ÑÓÐ=Ð×$Ñ$Ð=¬×(;Ñ(;Ð=Ñ(;Ó(=Ð=Ð$Ð(=Ñ=×=×=Ö=Ð$Ð(=×=×=×=×=×=Ñ=Œ5×=×=Ó=Œ5×=×=Ô=Ð×=×=Ò=Ð×=×=Ò=Ð$×=×=×=×=×=Ð=¬×=×=Ó=¬×=×=Ô=Ð(;×=×=Ò=Ð(=×=×=×=×=×=×=×=Ò=r   c           	      ó|  — t        | «       | j                  dt        |dz  «      «       t        j                  } |«       }d}||z  }||k(  }|�s
t        j                  d|fd||f«      dt        j                  «       v st        j                  t        «      rt        j                  t        «      ndt        j                  |«      t        j                  |«      dt        j                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      dœz  }dd	|iz  }t        t        j                  |«      «      ‚d x}x}x}x}}t        j                  } |«       }d}||z  }d
}	||	z  }
||
k(  }|�st        j                  d|fd||
f«      dt        j                  «       v st        j                  t        «      rt        j                  t        «      ndt        j                  |«      t        j                  |«      dt        j                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |	«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}x}x}x}	}
y )Nr   Ú
customdatar    )zS%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.data_dir
}()
} == (%(py6)s / %(py8)s)r   Útmp_path©r"   r#   r   r   r   úassert %(py11)sÚpy11Ú	workspace)ze%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.workspace_dir
}()
} == ((%(py6)s / %(py8)s) / %(py11)s))r"   r#   r   r   r   rE   r$   r%   )r   Úsetenvr   r   r/   r'   r(   r*   r+   r,   r)   r-   r.   r0   )r   rB   r;   r<   r6   r7   r5   Ú@py_format10Ú@py_format12Ú@py_assert10Ú@py_assert12r:   r>   s                r   Útest_env_overridesrL      s¢  € Ü�KÔ Ø×Ñ�¬¨H°|Ñ,CÓ(DÔEÜ�>‰>Ð6‰>ÓÐ6¨,Ð6˜x¨,Ñ6Ð6ÐÐ6Ñ6×6×6Ö6ÐÐ6×6×6×6×6×6Ñ6Œ5×6×6Ó6Œ5×6×6Ô6ˆ>×6×6Ò6Ð×6×6×6×6×6Ð6˜x×6×6Ó6˜x×6×6Ô6¨,×6×6×6×6×6×6×6Ü×ÑÐIÑÓ ÐI¨|ÐI H¨|Ñ$;ÐI¸kÐIÐ$;¸kÑ$IÐIÐ Ð$IÑI×I×IÖIÐ Ð$I×I×I×I×I×IÑIŒ5×I×IÓIŒ5×I×IÔIÐ×I×IÒIÐ ×I×I×I×I×IÐI H×I×IÓI H×I×IÔI¨|×I×IÒI¸k×I×I×I×I×I×I×IÔIr   c                 ó  — t        | «       | j                  dt        |dz  «      «       | j                  dt        |dz  «      «       t        j                  } |«       }d}||z  }||k(  }|�s
t        j                  d|fd||f«      dt        j                  «       v st        j                  t        «      rt        j                  t        «      ndt        j                  |«      t        j                  |«      dt        j                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      d	œz  }d
d|iz  }t        t        j                  |«      «      ‚d x}x}x}x}}y )Nr   rA   r   Úcustomwsr    )zX%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.workspace_dir
}()
} == (%(py6)s / %(py8)s)r   rB   rC   rD   rE   )r   rG   r   r   r0   r'   r(   r*   r+   r,   r)   r-   r.   ©	r   rB   r;   r<   r6   r7   r5   rH   rI   s	            r   Ú%test_env_overrides_workspace_explicitrP   !   sô   € Ü�KÔ Ø×Ñ�¬¨H°|Ñ,CÓ(DÔEØ×ÑÐ+¬S°¸JÑ1FÓ-GÔHÜ×ÑÐ9ÑÓ Ð9¨zÐ9 H¨zÑ$9Ð9Ð Ð$9Ñ9×9×9Ö9Ð Ð$9×9×9×9×9×9Ñ9Œ5×9×9Ó9Œ5×9×9Ô9Ð×9×9Ò9Ð ×9×9×9×9×9Ð9 H×9×9Ó9 H×9×9Ô9¨z×9×9×9×9×9×9×9Ð9r   c                 ó&  — t        | «       | j                  dt        |dz  «      «       | j                  dt        |dz  «      «       | j                  dt        |dz  «      «       t        j                  «        t        j
                  «       D �]€  }g }|j                  } |«       }|}|r|j                  } |«       }|}|�s@ddt        j                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      d	œz  }	|j                  |	«       |r€d
dt        j                  «       v st        j                  |«      rt        j                  |«      ndt        j                  «      t        j                  «      dœz  }
|j                  |
«       t        j                  |d«      i z  }dd|iz  }t        t        j                   |«      «      ‚d x}x}x}x}x}}�Œƒ y )Nr   Úcr   Údr   Úcaz:%(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s.exists
}()
}Úp)r#   r   r   z>%(py12)s
{%(py12)s = %(py10)s
{%(py10)s = %(py8)s.is_dir
}()
})r   r   r   r   zassert %(py15)sÚpy15)r   rG   r   r   Úensure_dirsÚall_dirsÚexistsÚis_dirr*   r+   r'   r,   r)   ÚappendÚ_format_boolopr-   r.   )r   rB   rU   r;   r<   r5   r4   r7   r=   Ú@py_format7r:   Ú@py_format14Ú@py_format16s                r   Útest_ensure_dirs_creates_allr`   (   sA  € Ü�KÔ Ø×ÑÐ(¬#¨h¸©nÓ*=Ô>Ø×Ñ�¬¨H°s©NÓ(;Ô<Ø×ÑÐ'¬¨X¸©_Ó)=Ô>Ü	×ÑÔÜ�^‰^Óó )ˆÙ(ˆq�x‰xÐ(‰x‹zÐ(ˆzÐ(‰z˜aŸh™hÐ(™h›jÐ(˜j×(×(×(×(×(Ñ(ˆq×(×(Ó(ˆq×(×(Ô(ˆx×(×(Ò(ˆz×(×(×(Ñ(‰z×(×(×(×(Õ(˜a×(×(Ó(˜a×(×(Ô(˜h×(×(Ò(˜j×(×(×(×(×(×(×(×(×(×(×(×(Õ(ñ)r   c                  ó   — t        t        j                  «      j                  d¬«      } d}|| v}|s™t	        j
                  d|fd|| f«      t	        j                  |«      dt        j                  «       v st	        j                  | «      rt	        j                  | «      nddœz  }dd	|iz  }t        t	        j                  |«      «      ‚d x}}y )
Nzutf-8)Úencodingz	/home/oem)únot in)z%(py1)s not in %(py3)sÚsrc)r   r   zassert %(py5)sÚpy5)r   r   Ú__file__Ú	read_textr'   r(   r)   r*   r+   r,   r-   r.   )rd   r4   r8   Ú@py_format4Ú@py_format6s        r   Útest_no_hardcoded_homerj   2   sw   € Ü
Œu�~‰~Ó
×
(Ñ
(°'Ð
(Ó
:€CØÐ!ˆ;˜cÐ!×!×!Õ!ˆ;˜c×!×!Ó!ˆ;×!×!×!×!×!Ð!˜c×!×!Ó!˜c×!×!×!×!×!×!Ô!r   c                 ó´  — | j                  dt        |dz  «      «       t        j                  } |«       }d}||z  }||k(  }|�s
t	        j
                  d|fd||f«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      ndt	        j                  |«      t	        j                  |«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      dœz  }dd	|iz  }t        t	        j                  |«      «      ‚d x}x}x}x}}y )
NÚCB26_PROJECT_ROOTÚmyprojr    )zW%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.project_root
}()
} == (%(py6)s / %(py8)s)r   rB   rC   rD   rE   )rG   r   r   Úproject_rootr'   r(   r*   r+   r,   r)   r-   r.   rO   s	            r   Útest_project_root_from_envro   7   sÒ   € Ø×ÑÐ*¬C°¸8Ñ0CÓ,DÔEÜ×ÑÐ6ÑÓÐ6¨hÐ6 8¨hÑ#6Ð6ÐÐ#6Ñ6×6×6Ö6ÐÐ#6×6×6×6×6×6Ñ6Œ5×6×6Ó6Œ5×6×6Ô6Ð×6×6Ò6Ð×6×6×6×6×6Ð6 8×6×6Ó6 8×6×6Ô6¨h×6×6×6×6×6×6×6Ð6r   c                  óf  — dd l } | j                  j                  dd «       t        j                  «       }d}||z  }d}||z  }|j
                  } |«       }|sÎt        j                  d|› �«      dz   dt        j                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      t        j                  |«      t        j                  |«      dœz  }t        t        j                  |«      «      ‚d x}x}x}x}x}}y )	Nr   rl   rd   r   zocekavan repo root, dostal z]
>assert %(py10)s
{%(py10)s = %(py8)s
{%(py8)s = ((%(py0)s / %(py2)s) / %(py5)s).is_dir
}()
}Úroot)r"   r#   re   r   r   )ÚosÚenvironÚpopr   rn   rZ   r'   Ú_format_assertmsgr*   r+   r,   r)   r-   r.   )	Ú_osrq   r;   r<   Ú@py_assert4Ú@py_assert6r6   r7   r9   s	            r   Ú"test_project_root_fallback_to_repory   <   sÐ   € ãØ‡K�K‡O�OÐ'¨Ô.Ü×ÑÓ€DØÐYˆD�5‰LÐY˜>ÐYˆL˜>Ñ)ÐYÐ)×1Ñ1ÐYÑ1Ó3ÐYÑ3×YÖYÐ7RÐSWÐRXÐ5Y×Y×Y×Y×Y×YÓYˆD×Y×YÓYˆD×Y×YÔY�5×Y×YÒY˜>×Y×YÒYÐ1×Y×YÒYÐ3×Y×Y×Y×Y×Y×YÓYr   )Úbuiltinsr*   Ú_pytest.assertion.rewriteÚ	assertionÚrewriter'   Úpathlibr   r   r   r   r   r?   rL   rP   r`   rj   ro   ry   © r   r   ú<module>r€      sA   ðß  „ Õ å ð€ò-ò
>òJò:ò)ò"ò
7ó
Zr   