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()