From 6b041741a421f2334a741e8d5896b8c718216809 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Fri, 27 Oct 2023 22:12:52 +0800 Subject: [PATCH] Update test_utils.py --- tests/test_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index fbcdeaff410c..a3d4e473e87c 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,5 +1,5 @@ import json -from typing import Dict, List, Union, TypeVar +from typing import Dict, List, Union, Literal, TypeVar from utils import FakeMessage, FakeMessageSegment from nonebot.utils import ( @@ -24,6 +24,8 @@ def test_generic_check_issubclass(): assert generic_check_issubclass(int, (int, float)) assert not generic_check_issubclass(str, (int, float)) assert generic_check_issubclass(Union[int, float, None], (int, float)) + assert generic_check_issubclass(Literal[1, 2, 3], int) + assert not generic_check_issubclass(Literal[1, 2, "3"], int) assert generic_check_issubclass(List[int], list) assert generic_check_issubclass(Dict[str, int], dict) assert generic_check_issubclass(TypeVar("T", int, float), (int, float))