diff --git a/tests/test_logging.py b/tests/test_logging.py index 6fd05cc..e515747 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -1,3 +1,5 @@ +from typing import Any +from diceutils.exceptions import TooManyLoggersError from diceutils.logging import Logger import pytest @@ -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)