study-buddy / tests /test_name_signal_extractor.py
GitHub Actions
deploy d092bea3608b7a29952f16357fda39b7a29e399b
2e818da
Raw
History Blame Contribute Delete
724 Bytes
import pytest
from app.services.name_signal_extractor import extract_preferred_name
@pytest.mark.parametrize(
("text", "expected"),
[
("My name is Anshuman.", "Anshuman"),
("My name is Anshuman, and I'm studying robotics.", "Anshuman"),
("My name is Anshuman and I'm studying robotics.", "Anshuman"),
("Please call me Anshuman.", "Anshuman"),
("You can call me Ash.", "Ash"),
("I go by Ash.", "Ash"),
("I am confused about robotics.", None),
("I am working on a robotics project.", None),
("I am not sure what to do next.", None),
],
)
def test_extract_preferred_name(text, expected):
assert extract_preferred_name(text) == expected