ó
    ³ü¡jÍ  ã                   ó    • S r SSKrSSKJs  Jr  SSKJr	  SSK
JrJr  SSKJrJr  SSKJr  SSS	S
SSSS.r\" SSSSSS9rS rS rS rS rS rg)züThe document identity the routes state ahead of the context.

The block is built from the documents row and prepended to the user message
on every answer path; the system prompt is untouched. Fields the row lacks
are left out rather than printed empty.é    N)Ú_prompt)ÚdeclaredÚfixed)ÚDocumentIdentityÚwith_document)ÚRetrievedChunki#  Ú705c9a88ad5d2694zQ1 2026 Earnings SupplementÚKREFz99-2iê  ÚQ1)ÚidÚdoc_keyÚtitleÚfolderÚfiling_typeÚyearÚperiodz#/tables/13Útableé   z<table></table>g{®Gáz„?)Úchunk_idÚ
chunk_typeÚpageÚcontentÚscorec                  ó  • [         R                  " [        5      R                  5       n U R	                  5       S S n/ SQo!U:H  o3(       do  [
        R                  " SU4SX45      [
        R                  " U5      [
        R                  " U5      S.-  nSSU0-  n[        [
        R                  " U5      5      eS =n=p2U R                  nSo&" U5      ow(       d¯  S	S
[        R                  " 5       ;   d  [
        R                  " U 5      (       a  [
        R                  " U 5      OS
[
        R                  " U5      [
        R                  " U5      [
        R                  " U5      S.-  n[        [
        R                  " U5      5      eS =n=p'g )Né   )ÚDocumentz%  Title:  Q1 2026 Earnings Supplementz  Issuer:  KREFz  Form:  99-2z  Period:  Q1 2026©ú==)z%(py1)s == %(py4)s)Úpy1Úpy4zassert %(py6)sÚpy6z%unless a chunk states another period.zJassert %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.endswith
}(%(py4)s)
}Úheader©Úpy0Úpy2r    r!   )r   Úfrom_rowÚROWr"   Ú
splitlinesÚ
@pytest_arÚ_call_reprcompareÚ	_safereprÚAssertionErrorÚ_format_explanationÚendswithÚ@py_builtinsÚlocalsÚ_should_repr_global_name)r"   Ú@py_assert0Ú@py_assert3Ú@py_assert2Ú@py_format5Ú@py_format7Ú@py_assert1Ú@py_assert5s           Ú8/home/mande/repo/quber/tests/playground/test_document.pyÚ)test_header_lists_the_row_fields_in_orderr:      s$  € Ü×&Ò&¤sÓ+×2Ñ2Ó4€FØ×ÑÓ˜r Ð"ð ò 'ð ð 'ñ ÷ ó ïé ôÐ"÷ ñ ïé ðÐ"÷ ð ïé ðð '÷ ÷ ÷ ñ ïé ÷÷ ð �?‰?ÐCÐBÐCˆ?ÐBÓCÐCÕC×C×C×C×C×CÑCˆ6×C×C×CÑCˆ6×C×CÕCˆ?×C×CÓCÐB×C×CÓCÐC×C×C×C×C×CÕCó    c                  óˆ  • [         R                  " SS05      R                  5       n SoU ;  o"(       d¥  [        R                  " SU4SX45      [        R
                  " U5      S[        R                  " 5       ;   d  [        R                  " U 5      (       a  [        R
                  " U 5      OSS.-  nSS	U0-  n[        [        R                  " U5      5      eS =pS
oU ;  o"(       d¥  [        R                  " SU4SX45      [        R
                  " U5      S[        R                  " 5       ;   d  [        R                  " U 5      (       a  [        R
                  " U 5      OSS.-  nSS	U0-  n[        [        R                  " U5      5      eS =pSoU ;   o"(       d¥  [        R                  " SU4SX45      [        R
                  " U5      S[        R                  " 5       ;   d  [        R                  " U 5      (       a  [        R
                  " U 5      OSS.-  nSS	U0-  n[        [        R                  " U5      5      eS =pg )Nr   z3M 2018 Form 10-KÚIssuer)únot in)z%(py1)s not in %(py3)sr"   ©r   Úpy3úassert %(py5)sÚpy5ÚPeriodz  Title:  3M 2018 Form 10-K©Úin©z%(py1)s in %(py3)s)r   r&   r"   r)   r*   r+   r/   r0   r1   r,   r-   )r"   r2   r4   Ú@py_format4Ú@py_format6s        r9   Ú test_missing_fields_are_left_outrI   '   s4  € Ü×&Ò&¨Ð1DÐ'EÓF×MÑMÓO€FØÐ!˜6Ñ!×!×!×!Ò!ˆ8×!×!Ô!ˆ8×!×!×!×!×!Ô!˜6×!×!×!Ñ!˜6×!×!×!×!×!×!Ó!ØÐ!˜6Ñ!×!×!×!Ò!ˆ8×!×!Ô!ˆ8×!×!×!×!×!Ô!˜6×!×!×!Ñ!˜6×!×!×!×!×!×!Ó!Ø(Ð2¨FÑ2×2×2×2Ò2Ð(×2×2Ô2Ð(×2×2×2×2×2Ô2¨F×2×2×2Ñ2¨F×2×2×2×2×2×2Ô2r;   c                  ó$  • Sn S n[        X5      nSo2U:H  oD(       dì  [        R                  " SU4SX#45      S[        R                  " 5       ;   d  [        R
                  " [         5      (       a  [        R                  " [         5      OS[        R                  " U 5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n[        [        R                  " U5      5      eS =n =n=n=pCg )NúContext chunks:r   )z9%(py6)s
{%(py6)s = %(py0)s(%(py2)s, %(py4)s)
} == %(py9)sr   )r$   r%   r    r!   Úpy9zassert %(py11)sÚpy11)	r   r)   r*   r/   r0   r1   r+   r,   r-   )r7   r3   r8   Ú@py_assert8Ú@py_assert7Ú@py_format10Ú@py_format12s          r9   Ú,test_no_document_leaves_the_prompt_unchangedrR   .   sœ   € Ø*ÐF¨DÐFŒ=Ð*Ó1ÐFÐ5FÐFÐ5FÑF×F×F×FÒFÐ1×F×F×F×F×FÕFŒ=×F×F×FÑFŒ=×F×FÕFÐ*×F×FÓF¨D×F×FÓFÐ1×F×FÓFÐ5F×F×F×F×F×F×F×FÐFr;   c                  óì  • [         R                  " [        5      n [        R                  [
        R                  [        4 GH0  nU" S[        /U 5      nUR                  nSoC" U5      oU(       d¯  SS[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n[        [        R                  " U5      5      eS =n=pESowU;   oˆ(       d¥  [        R                   " SU4SXr45      [        R                  " U5      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OSS	.-  n	S
SU	0-  n
[        [        R                  " U
5      5      eS =pxUR"                  nSoC" U5      oRR"                  nSoË" U5      oÕU:  oî(       GdY  [        R                   " SU4SX]45      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n[        [        R                  " U5      5      eS =n=n=n=n=n=pÍGM3     g )NúWhat was book value per share?z.Document
  Title:  Q1 2026 Earnings SupplementúLassert %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.startswith
}(%(py4)s)
}Úpromptr#   rK   rD   rF   r?   rA   rB   r   )Ú<)zˆ%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.index
}(%(py4)s)
} < %(py14)s
{%(py14)s = %(py10)s
{%(py10)s = %(py8)s.index
}(%(py12)s)
})r$   r%   r    r!   Úpy8Úpy10Úpy12Úpy14zassert %(py16)sÚpy16)r   r&   r'   r   Ú
prompt_forr   Úgrounded_promptÚCHUNKÚ
startswithr/   r0   r)   r1   r+   r,   r-   r*   Úindex)ÚidentityÚbuildrV   r7   r3   r8   r6   r2   r4   rG   rH   Ú@py_assert9Ú@py_assert11Ú@py_assert13rO   Ú@py_format15Ú@py_format17s                    r9   Ú.test_every_answer_path_opens_with_the_documentri   2   sþ  € Ü×(Ò(¬Ó-€HÜ×%Ñ%¤u×'7Ñ'7¼ÔIˆÙÐ7¼%¸À(ÓKˆØ× Ñ ÐSÐ!RÐSÐ Ð!RÓSÐSÕS×S×S×S×S×SÑSˆv×S×S×SÑSˆv×S×SÕSÐ ×S×SÓSÐ!R×S×SÓSÐS×S×S×S×S×SÔSØ Ð* FÑ*×*×*×*Ò*Ð ×*×*Ô*Ð ×*×*×*×*×*Ô* F×*×*×*Ñ* F×*×*×*×*×*×*Ó*Ø�|‰|ÐI˜JÐIˆ|˜JÓ'ÐI¯,©,ÐIÐ7HÐI¨,Ð7HÓ*IÐIÐ*IÑI×I×I×IÓIÐ'×I×I×I×I×IÕIˆv×I×I×IÑIˆv×I×IÕIˆ|×I×IÓI˜J×I×IÓIÐ'×I×I×I×I×IÔI¨&×I×I×IÑI¨&×I×IÕI¨,×I×IÓIÐ7H×I×IÓIÐ*I×I×I×I×I×I×I×IÖIò	 Jr;   c                  ó  • [         R                  [        R                  [        4 Hà  n U " S[        /5      nUR
                  nSo2" U5      oD(       d¯  SS[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n[        [        R                  " U5      5      eS =n=p4Mâ     g )NrT   rK   rU   rV   r#   )r   r]   r   r^   r_   r`   r/   r0   r)   r1   r+   r,   r-   )rc   rV   r7   r3   r8   r6   s         r9   Ú(test_paths_still_work_without_a_documentrk   ;   s¨   € Ü×%Ñ%¤u×'7Ñ'7¼ÓIˆÙÐ7¼%¸ÓAˆØ× Ñ Ð3Ð!2Ð3Ð Ð!2Ó3Ð3Õ3×3×3×3×3×3Ñ3ˆv×3×3×3Ñ3ˆv×3×3Õ3Ð ×3×3Ó3Ð!2×3×3Ó3Ð3×3×3×3×3×3Ö3ò Jr;   )Ú__doc__Úbuiltinsr/   Ú_pytest.assertion.rewriteÚ	assertionÚrewriter)   Úquber.playground.agentr   r^   Úquber.playground.answersr   r   Ú!quber.playground.answers.documentr   r   Úquber.playground.retrievalr   r'   r_   r:   rI   rR   ri   rk   © r;   r9   Ú<module>rv      sp   ðñ+÷ „ Õ =ß 4ß MÝ 5ð Ø!Ø*ØØØØñ€ñ 	Ø w°RÐARÐZ^ñ	€ò
	Dò3òGòJó4r;   