Skip to content

Commit 3d9aeb7

Browse files
committed
Fix: ensure timestamp difference in CLI topic test
1 parent f0c8aff commit 3d9aeb7

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

devchat/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def _count_tokens(encoding_tik: tiktoken.Encoding, string: str) -> int:
206206
return int(word_count / 0.75)
207207

208208

209-
def openai_message_tokens(messages: dict, model: str) -> int: # pylint: disable=unused-argument
209+
def openai_message_tokens(messages: dict, model: str) -> int: # pylint: disable=unused-argument
210210
"""Returns the number of tokens used by a message."""
211211
return len(encoding.encode(str(messages)))
212212

tests/test_cli_topic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import time
23
from click.testing import CliRunner
34
from devchat.utils import get_prompt_hash
45
from devchat._cli.main import main
@@ -15,6 +16,8 @@ def test_topic_list(git_repo): # pylint: disable=W0613
1516
assert result.exit_code == 0
1617
topic1 = get_prompt_hash(result.output)
1718

19+
time.sleep(3)
20+
1821
result = runner.invoke(
1922
main,
2023
['prompt', '--model=gpt-4', request]

0 commit comments

Comments
 (0)