
    εj                         d dl Zd dlmc mZ d dlZd dlmZm	Z	 d dl
mZmZmZ d dlmZ d dlmZ defdZdefdZdefd	Zd
 Zd Zd Zd Zd Zd Zd ZdS )    N)VideoCandidatevalidate_candidate)	TestBatchrenderable_candidatesvalidate_testbatch)ReviewPackageScriptQualityScorereturnc                  ,    t          dddddd          S )N	         lowhook_strengthnoveltyclarity	retentionai_slop_riskpolicy_riskr	        J/home/agent/jarvis_runtime/autoshortsbot/AutoShortsBot/tests/test_ideas.py_good_scorer   	   +       r   c                  ,    t          dddddd          S )N      r   r   r   r	   r   r   r   _weak_scorer       r   r   c                  ~    ddddddddd	d
dt                      ddd}|                    |            t          di |S )Nvid-001ai_life_systemsz1AI ist ein schlechter Gott, aber ein guter Dieneryoutubetiktok"   u)   AI sollte dir dienen, nicht dich führen.zLScene 1: AI chaos. Scene 2: controlled system. Scene 3: human approval gate.zGCinematic desk setup, phone automations, calm human-in-control framing.z(KI als Werkzeug, nicht als Wertekompass.z%Follow for practical AI life systems.)z#AIz#Productivity)zNo fake earnings claimsz>Values-first AI positioning gets more saves than hype content.)candidate_idpillartitle	platformsduration_secondshookscript_outlinevisual_conceptcaptionctahashtagsquality_scorepolicy_notes
hypothesisr   )r   updater   )	overridesdatas     r   
_candidater9      sd    !#D*;Zc=6,$4V! D$ 	KK	!!D!!!r   c                  @   t                      } t          |           }|j        }d}||u }|st          j        d|fd||f          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}}|j        }d}||k    }|st          j        d	|fd
||f          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 S )NTisz0%(py2)s
{%(py2)s = %(py0)s.is_valid
} is %(py5)sresultpy0py2py5assert %(py7)spy7r   ==)z.%(py2)s
{%(py2)s = %(py0)s.errors
} == %(py5)sr9   r   is_valid
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationerrors)	candidater>   @py_assert1@py_assert4@py_assert3@py_format6@py_format8s          r   ;test_candidate_validation_accepts_complete_growth_candidaterX   6   s   I	**F?"d"?d""""""""""?d""""""""""""6"""""6""""""?""""d"""""""""""""""""""""""""""=B=B=B66=Br   c                     t          dd          } t          |           }|j        }d}||u }|st          j        d|fd||f          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}|j        }||v }|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}}d}|j        }||v }|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}}d S )N    )r-   r,   Fr;   r=   r>   r?   rC   rD   zhook is requiredinz.%(py1)s in %(py5)s
{%(py5)s = %(py3)s.errors
}py1py3rB   z+duration_seconds must be between 10 and 180rG   	rR   r>   rS   rT   rU   rV   rW   @py_assert0@py_assert2s	            r   ?test_candidate_validation_rejects_missing_hook_and_bad_durationre   ?   s   Q777I	**F?#e#?e##########?e############6#####6######?####e###########################..................................................................8IFMI8MIIIIIIIIII8MIIIII8IIIIIIIIIIIFIIIIIFIIIIIIMIIIIIIIIIIIIIIIIIIIIIIIIIIIIIr   c                  (   t                      } |                     d          }t          |t                    }|sd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dt	          j                    v st          j        t                    rt          j        t                    ndt          j        |          dz  }t          t          j
        |                    d }|j        }d}||k    }|st          j        d	|fd
||f          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}}|j        }| j        }||k    }|st          j        d	|fd||f          dt	          j                    v st          j        |          rt          j        |          nd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}}|j        }| j        }||k    }|st          j        d	|fd||f          dt	          j                    v st          j        |          rt          j        |          nd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}}|j        }d}||k    }|st          j        d	|fd||f          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}}|j        }d}||k    }|st          j        d	|fd||f          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 S )Nz%data/local_motion_renders/vid-001.mp4)preview_pathz5assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}
isinstancepackager   )r@   r`   rA   py4r"   rE   )z4%(py2)s
{%(py2)s = %(py0)s.candidate_id
} == %(py5)sr?   rC   rD   )zH%(py2)s
{%(py2)s = %(py0)s.title
} == %(py6)s
{%(py6)s = %(py4)s.title
}rR   )r@   rA   rj   py6zassert %(py8)spy8)zZ%(py2)s
{%(py2)s = %(py0)s.script_summary
} == %(py6)s
{%(py6)s = %(py4)s.script_outline
}r$   )z1%(py2)s
{%(py2)s = %(py0)s.platforms
} == %(py5)s)z4%(py2)s
{%(py2)s = %(py0)s.preview_path
} == %(py5)s)r9   to_review_packagerh   r   rK   rL   rI   rM   rN   rO   rP   r(   rJ   r*   script_summaryr.   r+   rg   )rR   ri   rU   @py_format5rS   rT   rV   rW   @py_assert5@py_format7@py_format9s              r   1test_candidate_can_be_converted_to_review_packagers   I   s   I))7^)__Gg}---------------:-----:-------------g-----g-------------}-----}------------------------,9,9,,,,,,,,,,9,,,,,,,,,,,,7,,,,,7,,,,,,,,,,9,,,,,,,,,,,,,,,,,,,,,,,,,,,=+IO+=O++++++++++=O++++++++++++7+++++7++++++=+++++++++++I+++++I++++++O+++++++++++++++++++++++++++!=Y%==!%===========!%=============7=====7======!===========Y=====Y======%============================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57555557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J#JJ#JJJJJJJJJJJ#JJJJJJJJJJJJJ7JJJJJ7JJJJJJJJJJ#JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJr   c                     t          dt          d          t          dd          f          } t          |           }|j        }d}||u }|st	          j        d|fd	||f          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}|j        }||v }|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}}d S )N	batch-001dupr(   zAnother title)r(   r*   batch_id
candidatesFr;   r=   r>   r?   rC   rD   zcandidate ids must be uniquer\   r^   r_   )r   r9   r   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   	batchr>   rS   rT   rU   rV   rW   rc   rd   s	            r   9test_testbatch_validation_rejects_duplicate_candidate_idsr}   V   s   E***EAAA
  E  &&F?#e#?e##########?e############6#####6######?####e###########################):V]:)]::::::::::)]:::::):::::::::::V:::::V::::::]:::::::::::::::::::::::::::::r   c                  B   t          dd          } t          |           }|j        }d}||u }|st          j        d|fd||f          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}|j        }||v }|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}}d S )Nemptyr   rx   Fr;   r=   r>   r?   rC   rD   z"at least one candidate is requiredr\   r^   r_   )r   r   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   r{   s	            r   9test_testbatch_validation_requires_at_least_one_candidater   e   s   w2666E&&F?#e#?e##########?e############6#####6######?####e###########################/@6=@/=@@@@@@@@@@/=@@@@@/@@@@@@@@@@@6@@@@@6@@@@@@=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@r   c                     t          d          } t          dt                                }t          dd          }t          d| ||f	          }t          |          }| f}||k    }|st	          j        d
|fd||f          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}}d S )Nvalidrw   weak)r(   r3   invalidrZ   )r(   r-   ru   rx   rE   )z%(py0)s == %(py3)sselected)r@   ra   zassert %(py5)srB   )r9   r    r   r   rI   rJ   rK   rL   rM   rN   rO   rP   )	r   r   r   r|   r   rd   rS   @py_format4rV   s	            r   Itest_renderable_candidates_filters_by_candidate_validity_and_quality_gater   n   s*   G,,,E6GGGDib999G{tW7MNNNE$U++Hx8x8x88xr   c                  @   t          d          } t          |           }|j        }d}||u }|st          j        d|fd||f          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
}|j        }||v }|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}}d S )N)r%   linkedin)r+   Fr;   r=   r>   r?   rC   rD   zunsupported platform: linkedinr\   r^   r_   rG   rb   s	            r   3test_candidate_validation_rejects_unknown_platformsr   y   s   %<===I	**F?#e#?e##########?e############6#####6######?####e###########################+<v}<+}<<<<<<<<<<+}<<<<<+<<<<<<<<<<<v<<<<<v<<<<<<}<<<<<<<<<<<<<<<<<<<<<<<<<<<<<r   )builtinsrK   _pytest.assertion.rewrite	assertionrewriterI   pytestautoshorts.ideas.candidater   r   autoshorts.ideas.testbatchr   r   r   autoshorts.review.packager   autoshorts.scripting.qualityr
   r   r    r9   rX   re   rs   r}   r   r   r   r   r   r   <module>r      sQ                 I I I I I I I I [ [ [ [ [ [ [ [ [ [ 3 3 3 3 3 3 ; ; ; ; ; ;'    '    "~ " " " ".  J J J
K 
K 
K; ; ;A A A     = = = = =r   