Files
xb/app/tests/test_parse_amount_split.py

31 lines
958 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from __future__ import annotations
import unittest
from server import load_config, parse_records
class TestParseAmountSplit(unittest.TestCase):
def test_amount_before_comma_and_term_after_comma(self) -> None:
config = load_config()
raw_text = "#接龙\n11、 四马桥一潘纪君 拜访门窗商户微信提现15万存定期一年"
result = parse_records(raw_text, config, history=[])
records = result.get("new_records", [])
self.assertTrue(
any(
str(item.get("branch", "")) == "四马桥"
and str(item.get("type", "")) == "一年期定期"
and str(item.get("amount", "")) == "15万"
for item in records
)
)
skipped_reasons = [str(x.get("reason", "")) for x in result.get("skipped", [])]
self.assertNotIn("amount_not_found", skipped_reasons)
if __name__ == "__main__":
unittest.main()