
    ܓj2                     ^    d dl Zd dlmc mZ d dlmZ d dlm	Z	m
Z
 dZdefdZd Zd Zd	 ZdS )
    N)Path)!build_imported_clip_assembly_plandiscover_imported_ai_clipsz<hidden-money-systems-warum-ein-billiges-auto-teuer-sein-kannreturnc                  P    dt           dddddddd	d
dddddddddddddddgdS )Nzfree_production_jobs.v1z'Warum ein billiges Auto teuer sein kanniЄ  )idtitleduration_msscene_01cinematic_ai_videolocal_rendererprocedural_motiongffffff?u6   Dieser Occasion-Käufer denkt, er spart 4'000 Franken.)scene_id
asset_modeproviderexecution_modeduration_secondsoverlay_textscene_02g@zDas sieht harmlos aus.scene_03mechanism_animationmechanism_reveal_animation   u   Röntgenblick durch Preis...)schema_versionvideojobs)VIDEO_ID     N/home/agent/jarvis_runtime/AutoShortsBot/tests/test_imported_clip_assembler.py_production_jobsr!   	   s    3 +Tejkk '2,"5$' X  '2,"5$' 8  '3,">$& > #
  r   c                 N   | t           z  }|                    d           |dz                      d           |dz                      d           |dz                      dd	           t	          t           |           }t          |          }d
dh}||k    }|st          j        d|fd||f          dt          j	                    v st          j
        t
                    rt          j        t
                    nd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}}|d
         }d}||z  }	||	k    }|st          j        d|fd||	f          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}}	|d         }d}||z  }	||	k    }|st          j        d|fd||	f          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}}	d S )NTparentsscene_01.mp4   fakezscene_02.movz	notes.txtignorezutf-8)encodingr   r   ==)z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ssetclips)py0py1py3py6zassert %(py8)spy8)z%(py1)s == (%(py3)s / %(py5)s)clip_dir)r.   r/   py5)r   mkdirwrite_bytes
write_textr   r+   
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanation)
tmp_pathr2   r,   @py_assert2@py_assert5@py_assert4@py_format7@py_format9@py_assert0@py_assert6s
             r    Btest_discover_imported_ai_clips_finds_only_scene_named_video_filesrG   *   s   ("HNN4N   ++G444++G444''7'CCC&x::Eu::1*j11:11111111111:111111111111131111131111111111111u11111u111111:111111111111111111111111111111119>9> 99 99999999999 9999999999999999999999999999>999999999999999999999999999999>9> 99 99999999999 9999999999999999999999999999>9999999999999999999999999999999r   c                    | t           z  }|                    d           |dz                      d           t          t	                      |           }|d         }d}||k    }|slt          j        d|fd	||f          t          j        |          t          j        |          d
z  }dd|iz  }t          t          j	        |                    d x}x}}|d         d         }|t           k    }|st          j        d|fd|t           f          t          j        |          dt          j                    v st          j        t                     rt          j        t                     nddz  }dd|iz  }	t          t          j	        |	                    d x}}|d         d         }d}||u }|slt          j        d|fd||f          t          j        |          t          j        |          d
z  }dd|iz  }t          t          j	        |                    d x}x}}|d         }d}||k    }|slt          j        d|fd	||f          t          j        |          t          j        |          d
z  }dd|iz  }t          t          j	        |                    d x}x}}|d         d         }
|d         d         }|d         d         }|
d         }d }||k    }|slt          j        d|fd	||f          t          j        |          t          j        |          d
z  }dd|iz  }t          t          j	        |                    d x}x}}|
d!         }d}||z  }t          |          }||k    }|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        |          rt          j        |          nd$t          j        |          t          j        |          d%z  }d&d'|iz  }t          t          j	        |                    d x}x}x}x}}|
d(         }d}||u }|slt          j        d|fd||f          t          j        |          t          j        |          d
z  }dd|iz  }t          t          j	        |                    d x}x}}|d         }d)}||k    }|slt          j        d|fd	||f          t          j        |          t          j        |          d
z  }dd|iz  }t          t          j	        |                    d x}x}}|d*         }d+}||z  }t          |          }||k    }|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        |          rt          j        |          nd$t          j        |          t          j        |          d%z  }d&d'|iz  }t          t          j	        |                    d x}x}x}x}}|d         }d,}||k    }|slt          j        d|fd	||f          t          j        |          t          j        |          d
z  }dd|iz  }t          t          j	        |                    d x}x}}|d-         }d.}||k    }|slt          j        d|fd	||f          t          j        |          t          j        |          d
z  }dd|iz  }t          t          j	        |                    d x}x}}d S )/NTr#   r%   r&   imported_rootr   zimported_clip_assembly.v1r)   z%(py1)s == %(py4)sr.   py4assert %(py6)sr0   r   r   )z%(py1)s == %(py3)sr   )r.   r/   zassert %(py5)sr3   budget_policypaid_video_credits_allowedFisz%(py1)s is %(py4)sfinal_assemblylocal_ffmpegscenesr         sourceimported_ai_clip	clip_path)z<%(py1)s == %(py9)s
{%(py9)s = %(py3)s((%(py4)s / %(py6)s))
}strr2   )r.   r/   rM   r0   py9zassert %(py11)spy11captions_added_locallylocal_renderer_fallbackmissing_expected_clipzscene_02.mp4r   rolemechanism_or_caption_layer)r   r4   r5   r   r!   r7   r8   r<   r=   r>   r9   r:   r;   r\   )r?   r2   planrE   @py_assert3r@   @py_format5rC   @py_format4@py_format6r   r   r   rA   @py_assert7@py_assert8@py_format10@py_format12s                     r    [test_build_imported_clip_assembly_plan_prefers_imported_realistic_clips_and_local_fallbacksrm   8   sZ	   ("HNN4N   ++G444,-=-?-?xXXXD !@%@@!%@@@@@@@@@@@!%@@@@@@!@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@=*(**********(****************(*****(*************************** !=>G%G>%GGGGGGGGGG>%GGGGG>GGGG%GGGGGGGGGGGGGGGGGGGGGGGGGGG !3^3!^3333333333!^33333!3333^333333333333333333333333333H~a HH~a HH~a HH3!33!33333333333!3333333333!3333333333333333333333333333K B>B>(ABC(A$B$BB $BBBBBBBBBBB $BBBBBB BBBBBBBBBBBCBBBBBCBBBBBBBBBBBBBBBBBBBBBBBB>BBBB$BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,-55-5555555555-55555-5555555555555555555555555555555H:!::!:::::::::::!::::::::::!::::::::::::::::::::::::::::+,N~NH~4MN4M0N0NN,0NNNNNNNNNNN,0NNNNNN,NNNNNNNNNNNNNNNNNNNNNNNNNNNNNHNNNNNHNNNNNN~NNNN0NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNH1!11!11111111111!1111111111!1111111111111111111111111111F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;r   c                    t          t                      |           }t          d |d         D                       }|d         }d}||u }|slt          j        d|fd||f          t          j        |          t          j        |          dz  }d	d
|iz  }t          t          j        |                    d x}x}}d}|d         }||v }|slt          j        d|fd||f          t          j        |          t          j        |          dz  }d	d
|iz  }t          t          j        |                    d x}x}}|d         }d}||k    }|slt          j        d|fd||f          t          j        |          t          j        |          dz  }d	d
|iz  }t          t          j        |                    d x}x}}d S )NrI   c              3   2   K   | ]}|d          dk    |V  dS )r   chatgpt_pro_soraNr   ).0notes     r    	<genexpr>z\test_chatgpt_pro_video_generation_is_marked_unavailable_in_assembly_notes.<locals>.<genexpr>V   s2      ii$zBRVhBhBhtBhBhBhBhiir   provider_notes"available_for_new_video_generationFrQ   rS   rL   rN   r0   z@Sora web and app experiences were discontinued on April 26, 2026evidence)in)z%(py1)s in %(py4)sdecision#do_not_use_for_new_video_generationr)   rK   )r   r!   nextr7   r8   r<   r=   r>   )r?   rd   openai_noterE   re   r@   rf   rC   s           r    Itest_chatgpt_pro_video_generation_is_marked_unavailable_in_assembly_notesr|   S   sH   ,-=-?-?xXXXDii-=(>iiiiiK;<EE<EEEEEEEEEE<EEEEE<EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEMhQ\]gQhhMQhhhhhhhhhhhMQhhhhhhMhhhhQhhhhhhhhhhhhhhhhhhhhhhhhhhhhz"K&KK"&KKKKKKKKKKK"&KKKKKK"KKKK&KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKr   )builtinsr9   _pytest.assertion.rewrite	assertionrewriter7   pathlibr   "autoshorts.imported_clip_assemblerr   r   r   dictr!   rG   rm   r|   r   r   r    <module>r      s                        l l l l l l l l J$    B: : :< < <6L L L L Lr   