mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-01 17:37:43 +00:00
fix: prevent JSON content from being added multiple times during retries (#1255)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
|
||||
|
||||
class MockBackend:
|
||||
def __init__(self):
|
||||
self.messages = []
|
||||
|
||||
def _add_json_in_prompt(self, new_messages):
|
||||
self.messages.append("JSON_ADDED")
|
||||
|
||||
|
||||
def test_json_added_once():
|
||||
backend = MockBackend()
|
||||
try_n = 3
|
||||
json_added = False
|
||||
new_messages = ["msg1"]
|
||||
|
||||
for _ in range(try_n):
|
||||
if not json_added:
|
||||
backend._add_json_in_prompt(new_messages)
|
||||
json_added = True
|
||||
|
||||
assert backend.messages.count("JSON_ADDED") == 1
|
||||
Reference in New Issue
Block a user