Skip to content

Commit fc87e3c

Browse files
committed
gh-106318: Add doctest role for str.isnumeric() examples
1 parent 546fb5f commit fc87e3c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Doc/library/stdtypes.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,19 +2155,20 @@ expression support in the :mod:`re` module).
21552155
that have the Unicode numeric value property, e.g. U+2155,
21562156
VULGAR FRACTION ONE FIFTH. Formally, numeric characters are those with the property
21572157
value Numeric_Type=Digit, Numeric_Type=Decimal or Numeric_Type=Numeric.
2158+
For example:
21582159

2159-
For example::
2160+
.. doctest::
21602161

21612162
>>> '0123456789'.isnumeric()
21622163
True
2163-
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() #ARABIC-INDIC DIGIT ZERO TO NINE
2164+
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine
21642165
True
2165-
>>> '⅕'.isnumeric() # VULGAR FRACTION ONE FIFTH
2166+
>>> ''.isnumeric() # Vulgar fraction one fifth
21662167
True
2167-
>>> '²'.isdigit(), '²'.isdecimal(), '²'.isnumeric()
2168-
(True, False, True)
2168+
>>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()
2169+
(False, True, True)
21692170

2170-
See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters is a
2171+
See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are
21712172
decimal numbers superset.
21722173

21732174

0 commit comments

Comments
 (0)