Spaces:
Sleeping
Sleeping
| from cbt_knowledge import detect_distortions | |
| def codes(text: str): | |
| return {c for c, _ in detect_distortions(text)} | |
| def test_detect_all_or_nothing(): | |
| assert "AO" in codes("I always fail; nothing works") | |
| def test_detect_fortune_telling(): | |
| assert "FT" in codes("I will fail the interview") | |
| def test_detect_should_statements(): | |
| assert "SH" in codes("I should always be productive") | |
| def test_detect_labeling(): | |
| assert "LB" in codes("I'm such an idiot") | |
| def test_no_false_positive_on_neutral_text(): | |
| assert detect_distortions("I went to the park and had a nice day.") == [] | |