Skip to content

Commit

Permalink
test(logging): add multiple test
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 committed Mar 1, 2024
1 parent 52806cc commit 84062ca
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any
from diceutils.exceptions import TooManyLoggersError
from diceutils.logging import Logger

import pytest
Expand Down Expand Up @@ -86,3 +88,31 @@ def test_clear(logger):
assert logger.load("0", "0") == []
assert logger.loadall() == {}
logger.rescue()


def test_multiple(logger):
session_id = "0"
for i in range(3):
logger.add(
session_id,
i,
user_id="0",
user_role="KP",
data=[{"type": "text"}],
message_sequence="xxx",
)

try:
logger.add(
session_id,
3,
user_id="0",
user_role="KP",
data=[{"type": "text"}],
message_sequence="xxx",
)
exception = None
except Exception as err:
exception = err

assert isinstance(exception, TooManyLoggersError)

0 comments on commit 84062ca

Please sign in to comment.