pickle -> sqlite store: D6 async writes, D9 reload race, one-shot pickle migration
This commit is contained in:
+2
-6
@@ -107,17 +107,13 @@ class TestFunctionality(TestBotBase):
|
||||
' "channel": "some_channel", "direct": false, "historise_question": true}',
|
||||
)
|
||||
|
||||
@patch("builtins.open", new_callable=mock_open)
|
||||
def test_update_history_with_file(self, mock_file):
|
||||
def test_update_history_trims_to_limit(self):
|
||||
self.bot.airesponder.update_history({"content": '{"q": "What\'s your name?"}'}, {"content": '{"a": "AI"}'}, 10)
|
||||
self.assertEqual(len(self.bot.airesponder.history), 2)
|
||||
self.bot.airesponder.update_history({"content": '{"q1": "Q1"}'}, {"content": '{"a1": "A1"}'}, 2)
|
||||
self.bot.airesponder.update_history({"content": '{"q2": "Q2"}'}, {"content": '{"a2": "A2"}'}, 2)
|
||||
self.assertEqual(len(self.bot.airesponder.history), 2)
|
||||
self.bot.airesponder.history_file = "mock_file.pkl"
|
||||
self.bot.airesponder.update_history({"content": '{"q": "What\'s your favorite color?"}'}, {"content": '{"a": "Blue"}'}, 10)
|
||||
mock_file.assert_called_once_with("mock_file.pkl", "wb")
|
||||
mock_file().write.assert_called_once()
|
||||
# File persistence moved to the SQLite store — covered by PER-01 (SPEC-009)
|
||||
|
||||
|
||||
if __name__ == "__mait__":
|
||||
|
||||
Reference in New Issue
Block a user