Skip to content

Commit 60362f3

Browse files
committed
Increase coverage
1 parent 282531a commit 60362f3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_jsonschema/test_jsonschema_pep_695.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
from mashumaro.core.meta.types.common import clean_id
12
from mashumaro.jsonschema import build_json_schema
23
from mashumaro.jsonschema.models import Context
4+
from mashumaro.jsonschema.schema import _type_alias_definition_name
35

46
type JSON = int | str | float | bool | None | list[JSON] | dict[str, JSON]
57
type X = int | str
@@ -122,3 +124,14 @@ def test_type_alias_placeholder_not_leaking_into_context_defs() -> None:
122124
]
123125
}
124126
assert ctx.definitions == {}
127+
128+
129+
def test_type_alias_definition_name_falls_back_to_clean_id_when_name_empty() -> (
130+
None
131+
):
132+
class NamelessAlias:
133+
__name__ = ""
134+
135+
alias = NamelessAlias()
136+
137+
assert _type_alias_definition_name(alias) == clean_id(str(id(alias)))

0 commit comments

Comments
 (0)