FinSight / tests /test_sector.py
Sanjam19's picture
Deploy FinSight demo (single-container Docker Space)
d4f8959 verified
Raw
History Blame Contribute Delete
815 Bytes
from backend.sector import detect_sector
def test_bank_text_detected():
text = (
"The bank reported total deposits and advances. NIM improved. "
"Gross NPA declined. CASA ratio stood at 45%. RBI guidelines followed."
)
assert detect_sector(text) == "BANK"
def test_it_text_detected():
text = (
"TCS reported strong growth across IT services. "
"Attrition was 12%. Offshore delivery and software exports grew."
)
assert detect_sector(text) == "IT"
def test_generic_text_falls_back_to_general():
assert detect_sector("The company reported strong results this year.") == "GENERAL"
def test_fewer_than_three_keyword_hits_is_general():
# one keyword alone shouldn't flip the sector
assert detect_sector("Some deposits were made.") == "GENERAL"