MCPcopy Create free account
hub / github.com/ipython/traitlets / mypy_union_typing

Function mypy_union_typing

tests/test_typing.py:78–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77@pytest.mark.mypy_testing
78def mypy_union_typing() -> None:
79 class T(HasTraits):
80 style = Union(
81 [Unicode("default"), Type(klass=object)],
82 help="Name of the pygments style to use",
83 default_value="hi",
84 ).tag(config=True)
85
86 t = T()
87 reveal_type(Union("foo")) # R: traitlets.traitlets.Union
88 reveal_type(Union("").tag(sync=True)) # R: traitlets.traitlets.Union
89 reveal_type(Union(None, allow_none=True)) # R: traitlets.traitlets.Union
90 reveal_type(Union(None, allow_none=True).tag(sync=True)) # R: traitlets.traitlets.Union
91 reveal_type(T.style) # R: traitlets.traitlets.Union
92 reveal_type(t.style) # R: Any
93
94
95@pytest.mark.mypy_testing

Callers

nothing calls this directly

Calls 4

UnionClass · 0.90
TClass · 0.85
reveal_typeFunction · 0.85
tagMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…