| 1 | import sys, os |
| 2 | |
| 3 | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 4 | import models |
| 5 | |
| 6 | ex1 = "<think>reasoning goes here</think>response goes here" |
| 7 | ex2 = "<think>reasoning goes here</thi" |
| 8 | |
| 9 | |
| 10 | import pytest |
| 11 | |
| 12 | |
| 13 | @pytest.mark.parametrize("example", [ex1, ex2]) |
| 14 | def test_example(example: str): |
| 15 | res = models.ChatGenerationResult() |
| 16 | for i in range(len(example)): |
| 17 | char = example[i] |
| 18 | chunk = res.add_chunk({"response_delta": char, "reasoning_delta": ""}) |
| 19 | print(i, ":", chunk) |
| 20 | |
| 21 | print("output", res.output()) |
| 22 | |
| 23 | |
| 24 | if __name__ == "__main__": |
| 25 | # test_example(ex1) |
| 26 | test_example(ex2) |