Python 3.10 tag issubclass bug: (#832)

This commit is contained in:
Elijah Ahianyo 2023-04-17 17:08:43 +00:00 committed by GitHub
parent c3148d348c
commit a52145e52a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -67,7 +67,7 @@ class Tag(Base):
if isinstance(prop, Var):
if not prop.is_local or prop.is_string:
return str(prop)
if issubclass(prop.type_, str):
if types._issubclass(prop.type_, str):
return format.json_dumps(prop.full_name)
prop = prop.full_name

View File

@ -1,4 +1,4 @@
from typing import Dict
from typing import Any, Dict
import pytest
@ -41,6 +41,16 @@ def mock_event(arg):
),
({"a": "red", "b": "blue"}, '{{"a": "red", "b": "blue"}}'),
(BaseVar(name="var", type_="int"), "{var}"),
(
BaseVar(
name="_",
type_=Any,
state="",
is_local=True,
is_string=False,
),
"{_}",
),
(BaseVar(name='state.colors["a"]', type_="str"), '{state.colors["a"]}'),
({"a": BaseVar(name="val", type_="str")}, '{{"a": val}}'),
({"a": BaseVar(name='"val"', type_="str")}, '{{"a": "val"}}'),