Commit 6a573cd8 authored by Stefan Behnel's avatar Stefan Behnel

Resolve some doctest issues in Python 3.11.

parent 01bca828
"""
>>> import sys
>>> ONE, TEN, HUNDRED
(1, 10, 100)
>>> THOUSAND # doctest: +ELLIPSIS
......@@ -35,8 +37,10 @@ NameError: ...name 'RANK_3' is not defined
>>> set(PyxEnum) == {TWO, THREE, FIVE}
True
>>> str(PyxEnum.TWO).split(".")[-1] # Py3.10 changed the output here
>>> str(PyxEnum.TWO).split(".")[-1] if sys.version_info < (3,11) else "TWO" # Py3.10/11 changed the output here
'TWO'
>>> str(PyxEnum.TWO) if sys.version_info >= (3,11) else "2" # Py3.10/11 changed the output here
'2'
>>> PyxEnum.TWO + PyxEnum.THREE == PyxEnum.FIVE
True
>>> PyxEnum(2) is PyxEnum["TWO"] is PyxEnum.TWO
......
# mode: run
class Foo:
@property
def foo(self):
......@@ -36,6 +38,6 @@ def wrap_hasattr(obj, name):
>>> hasattr(Foo(), None) #doctest: +ELLIPSIS
Traceback (most recent call last):
...
TypeError: hasattr(): attribute name must be string
TypeError: ...attribute name must be string...
"""
return hasattr(obj, name)
......@@ -1482,7 +1482,7 @@ class UnicodeTest(CommonTest,
self.assertEqual(('...%(foo)s...' % {'foo':Str.ABC}).replace("Str.", ""),
'...ABC...')
self.assertEqual(('...%(foo)s...' % {'foo':Int.IDES}).replace("Int.", ""),
'...IDES...')
'...IDES...' if sys.version_info < (3,11) else '...15...')
self.assertEqual('...%(foo)i...' % {'foo':Int.IDES},
'...15...')
self.assertEqual('...%(foo)d...' % {'foo':Int.IDES},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment