Spaces:
Sleeping
Sleeping
File size: 724 Bytes
2e818da | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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
|