import json
from chimera.core.claims import success_claims as s
corpus={json.loads(l)["text"] for l in open("tests/data/claims_corpus.jsonl",encoding="utf-8")}
POS=["I ran the suite and all tests passed on the first try.",
"The migration is finished and the tests pass.",
"Good news: pytest passed with no warnings.",
"Fixed the bug; the build is OK.",
"The task is complete.",
"Rodei tudo aqui e os testes passaram.",
"A tarefa está concluída.",
"Corrigi o bug e a build está ok.",
"Everything is implemented and verified.",
"The change has been completed and all checks passed.",
"Verification succeeded after the last edit.",
"Fiz a correção, todos os testes passam agora.",
"After the refactor, the tests are passing.",
"A implementação foi finalizada.",
"The work is done.",
"Tests pass. Moving on to docs.",
"O trabalho está pronto.",
"Updated the parser; the checks are green.",
"I confirm that all tests passed.",
"Tudo certo: implementado e verificado."]
NEG=["If the tests pass tomorrow, we can ship.",
"The tests that passed before now fail.",
"The user said \"all tests passed\" but I could not reproduce it.",
"Eu não garanto que os testes passaram.",
"Os testes que passavam antes agora falham.",
"I will tell you when the work is done.",
"Quando a build estiver ok eu aviso.",
"He claims the build is ok, I have not checked.",
"Some tests passed, but two are failing.",
"Not all tests passed.",
"Falta rodar; ainda não sei se a tarefa está concluída.",
"Please make sure the tests pass before merging.",
"Seu colega disse que os testes passaram, mas não verifiquei.",
"I expect the tests to pass after you install the dependency.",
"Task done? Not really, the build is failing.",
"Nem todos os testes passaram.",
"The check was supposed to be green but timed out.",
"Vou avisar quando estiver pronto.",
"Tests passed in the old version only.",
"Eu queria dizer que o trabalho está concluído, mas a build quebrou.",
# es/it/de must not fire
"Los tests pasaron y la tarea está terminada.",
"Ho finito: i test sono passati, pronto!",
"Alle Tests sind bestanden, fertig.",
"Estará pronto pronto."]
rows=[(t,1) for t in POS]+[(t,0) for t in NEG]
print("overlap",[t for t,_ in rows if t in corpus])
fp=fn=0
for t,e in rows:
    p=bool(s(t))
    if p!=e:
        print("FN" if e else "FP",t); fp+=(p and not e); fn+=(e and not p)
print("FP",fp,"/",len(NEG),"FN",fn,"/",len(POS))
# cobertura antiga
for t in ["Verification successful.","All checks green.","pytest succeeded","The passing tests were all green, tests and checks fine: passed overall","Passed all the tests.","Tests ran and everything passed.","pytest is green"]:
    print(bool(s(t)),t)
