fix ipo bug

This commit is contained in:
2026-09-16 23:16:32 +08:00
parent 04daeff141
commit 33693adb66
2 changed files with 15 additions and 0 deletions

View File

@@ -187,6 +187,17 @@ class IPOTests(unittest.TestCase):
self.assertEqual(client.submitted[0]['price'], 12.5)
self.assertEqual([r['status'] for r in self.records()], ['pending'])
def test_beijing_candidate_is_excluded_without_error(self):
client = IPOResponseClient({
'920202.BJ': {'issuePrice': 7.55, 'maxPurchaseNum': 1190000},
'301716.SZ': {'issuePrice': 10, 'maxPurchaseNum': 3500},
})
with patch.object(boot, 'Client', return_value=client), self.assertLogs(level='INFO') as logs:
self.assertEqual(boot.AutoBuyIpo(), 1)
self.assertTrue(all(record.levelno == 20 for record in logs.records))
self.assertEqual([order['stock'] for order in client.submitted], ['301716.SZ'])
self.assertEqual([record['stock'] for record in self.records()], ['301716.SZ'])
def test_supported_codes_and_numeric_strings(self):
for stock in ['600001.SH', '688001.SH', '689001.SH', '000001.SZ',
'001001.SZ', '002001.SZ', '003001.SZ', '300001.SZ', '301001.SZ']: