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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
88b77db9
Commit
88b77db9
authored
Aug 24, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests for CheckedResult exception propagation
parent
348e30f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
tests/run/cpp_exceptions_checked_result.pyx
tests/run/cpp_exceptions_checked_result.pyx
+75
-0
No files found.
tests/run/cpp_exceptions_checked_result.pyx
0 → 100644
View file @
88b77db9
# mode: run
# tag: cpp, cpp11
cdef
int
raises
(
int
success
)
nogil
except
~
:
if
not
success
:
with
gil
:
raise
ValueError
(
"wrong value"
)
else
:
return
success
def
test_caught_exception
():
"""
>>> test_caught_exception()
1
"""
cdef
int
r1
try
:
with
nogil
:
r1
=
raises
(
0
)
except
ValueError
as
e
:
return
1
return
0
def
test_no_exception
():
"""
>>> test_no_exception()
1
"""
cdef
int
r1
try
:
with
nogil
:
r1
=
raises
(
1
)
except
ValueError
as
e
:
return
0
return
r1
cdef
void
void_raises
(
int
success
)
nogil
except
~
:
if
not
success
:
with
gil
:
raise
ValueError
(
"wrong value"
)
def
test_void_return_exception
():
"""
>>> test_void_return_exception()
1
"""
try
:
void_raises
(
0
)
return
0
except
ValueError
as
e
:
return
1
cdef
cypclass
Raises
:
int
raises
(
self
,
int
success
)
nogil
except
~
:
if
not
success
:
with
gil
:
raise
ValueError
(
"wrong value"
)
else
:
return
success
def
test_method_exception
():
"""
>>> test_method_exception()
1
"""
cdef
int
r1
r
=
Raises
()
try
:
with
nogil
:
r1
=
r
.
raises
(
0
)
except
ValueError
as
e
:
return
1
return
r1
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