Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
6a573cd8
Commit
6a573cd8
authored
Feb 24, 2022
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve some doctest issues in Python 3.11.
parent
01bca828
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
tests/run/cpdef_enums.pyx
tests/run/cpdef_enums.pyx
+5
-1
tests/run/hasattr.pyx
tests/run/hasattr.pyx
+3
-1
tests/run/test_unicode.pyx
tests/run/test_unicode.pyx
+1
-1
No files found.
tests/run/cpdef_enums.pyx
View file @
6a573cd8
"""
>>> 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
...
...
tests/run/hasattr.pyx
View file @
6a573cd8
# 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
)
tests/run/test_unicode.pyx
View file @
6a573cd8
...
...
@@ -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
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment