File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ Module contents
498498.. function :: is_dataclass(obj)
499499
500500 Return ``True `` if its parameter is a dataclass (including subclasses of a
501- dataclass, but not including :ref: `generic specializations <types-generic-aliases >`)
501+ dataclass, but not including :ref: `generic aliases <types-genericalias >`)
502502 or an instance of one, otherwise return ``False ``.
503503
504504 If you need to know if a class is an instance of a dataclass (and
Original file line number Diff line number Diff line change @@ -416,7 +416,7 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
416416 Return ``True `` if the object is a class, whether built-in or created in Python
417417 code.
418418
419- This function returns ``False `` for :ref: `generic specializations <types-generic-aliases >` of classes,
419+ This function returns ``False `` for :ref: `generic aliases <types-genericalias >` of classes,
420420 such as ``list[int] ``.
421421
422422
Original file line number Diff line number Diff line change @@ -3633,17 +3633,21 @@ Introspection helpers
36333633
36343634 Determine if a type is a :class: `Protocol `.
36353635
3636- For example::
3636+ For example:
3637+
3638+ .. testcode ::
36373639
36383640 class P(Protocol):
36393641 def a(self) -> str: ...
36403642 b: int
36413643
3642- is_protocol(P) # => True
3643- is_protocol(int) # => False
3644+ assert is_protocol(P)
3645+ assert not is_protocol(int)
36443646
36453647 This function only returns true for ``Protocol `` classes, not for
3646- :ref: `generic specializations <types-generic-aliases >` of them::
3648+ :ref: `generic aliases <types-genericalias >` of them:
3649+
3650+ .. testcode ::
36473651
36483652 class GenericP[T](Protocol):
36493653 def a(self) -> T: ...
@@ -3673,7 +3677,9 @@ Introspection helpers
36733677 assert not is_typeddict(TypedDict)
36743678
36753679 This function only returns true for ``TypedDict `` classes, not for
3676- :ref: `generic specializations <types-generic-aliases >` of them::
3680+ :ref: `generic aliases <types-genericalias >` of them:
3681+
3682+ .. testcode ::
36773683
36783684 class GenericFilm[T](TypedDict):
36793685 title: str
You can’t perform that action at this time.
0 commit comments