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
2324b99c
Commit
2324b99c
authored
Sep 22, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent C compiler from seeing "1/0" in test code. MSVC is heavily upset about it.
parent
32b9dd8c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
tests/run/test_asyncgen.py
tests/run/test_asyncgen.py
+14
-12
No files found.
tests/run/test_asyncgen.py
View file @
2324b99c
...
@@ -17,6 +17,8 @@ import contextlib
...
@@ -17,6 +17,8 @@ import contextlib
#asyncio = import_module("asyncio")
#asyncio = import_module("asyncio")
ZERO
=
0
try
:
try
:
if
sys
.
version_info
[:
2
]
==
(
3
,
4
):
if
sys
.
version_info
[:
2
]
==
(
3
,
4
):
# asnycio in Py3.4 does not support awaitable coroutines (requires iterators instead)
# asnycio in Py3.4 does not support awaitable coroutines (requires iterators instead)
...
@@ -343,7 +345,7 @@ class AsyncGenTest(unittest.TestCase):
...
@@ -343,7 +345,7 @@ class AsyncGenTest(unittest.TestCase):
async
def
gen
():
async
def
gen
():
await
awaitable
()
await
awaitable
()
yield
123
yield
123
1
/
0
1
/
ZERO
g
=
gen
()
g
=
gen
()
ai
=
g
.
__aiter__
()
ai
=
g
.
__aiter__
()
...
@@ -381,7 +383,7 @@ class AsyncGenTest(unittest.TestCase):
...
@@ -381,7 +383,7 @@ class AsyncGenTest(unittest.TestCase):
def
sync_gen
():
def
sync_gen
():
try
:
try
:
yield
1
yield
1
1
/
0
1
/
ZERO
finally
:
finally
:
yield
2
yield
2
yield
3
yield
3
...
@@ -391,7 +393,7 @@ class AsyncGenTest(unittest.TestCase):
...
@@ -391,7 +393,7 @@ class AsyncGenTest(unittest.TestCase):
async
def
async_gen
():
async
def
async_gen
():
try
:
try
:
yield
1
yield
1
1
/
0
1
/
ZERO
finally
:
finally
:
yield
2
yield
2
yield
3
yield
3
...
@@ -406,7 +408,7 @@ class AsyncGenTest(unittest.TestCase):
...
@@ -406,7 +408,7 @@ class AsyncGenTest(unittest.TestCase):
yield
1
yield
1
finally
:
finally
:
yield
2
yield
2
1
/
0
1
/
ZERO
yield
3
yield
3
yield
100
yield
100
...
@@ -418,7 +420,7 @@ class AsyncGenTest(unittest.TestCase):
...
@@ -418,7 +420,7 @@ class AsyncGenTest(unittest.TestCase):
finally
:
finally
:
await
awaitable
()
await
awaitable
()
yield
2
yield
2
1
/
0
1
/
ZERO
yield
3
yield
3
yield
100
yield
100
...
@@ -429,7 +431,7 @@ class AsyncGenTest(unittest.TestCase):
...
@@ -429,7 +431,7 @@ class AsyncGenTest(unittest.TestCase):
def
sync_gen
():
def
sync_gen
():
try
:
try
:
yield
1
yield
1
1
/
0
1
/
ZERO
finally
:
finally
:
yield
2
yield
2
yield
3
yield
3
...
@@ -440,7 +442,7 @@ class AsyncGenTest(unittest.TestCase):
...
@@ -440,7 +442,7 @@ class AsyncGenTest(unittest.TestCase):
try
:
try
:
await
awaitable
()
await
awaitable
()
yield
1
yield
1
1
/
0
1
/
ZERO
finally
:
finally
:
yield
2
yield
2
await
awaitable
()
await
awaitable
()
...
@@ -513,7 +515,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
...
@@ -513,7 +515,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
yield
1
yield
1
await
asyncio
.
sleep
(
0.01
,
loop
=
self
.
loop
)
await
asyncio
.
sleep
(
0.01
,
loop
=
self
.
loop
)
yield
2
yield
2
1
/
0
1
/
ZERO
yield
3
yield
3
with
self
.
assertRaises
(
ZeroDivisionError
):
with
self
.
assertRaises
(
ZeroDivisionError
):
...
@@ -689,7 +691,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
...
@@ -689,7 +691,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async
def
foo
():
async
def
foo
():
try
:
try
:
yield
1
yield
1
1
/
0
1
/
ZERO
finally
:
finally
:
await
asyncio
.
sleep
(
0.01
,
loop
=
self
.
loop
)
await
asyncio
.
sleep
(
0.01
,
loop
=
self
.
loop
)
yield
12
yield
12
...
@@ -712,7 +714,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
...
@@ -712,7 +714,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
nonlocal
DONE
nonlocal
DONE
try
:
try
:
yield
1
yield
1
1
/
0
1
/
ZERO
finally
:
finally
:
await
asyncio
.
sleep
(
0.01
,
loop
=
self
.
loop
)
await
asyncio
.
sleep
(
0.01
,
loop
=
self
.
loop
)
await
asyncio
.
sleep
(
0.01
,
loop
=
self
.
loop
)
await
asyncio
.
sleep
(
0.01
,
loop
=
self
.
loop
)
...
@@ -905,7 +907,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
...
@@ -905,7 +907,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async
def
sleep_n_crash
(
delay
):
async
def
sleep_n_crash
(
delay
):
await
asyncio
.
sleep
(
delay
,
loop
=
self
.
loop
)
await
asyncio
.
sleep
(
delay
,
loop
=
self
.
loop
)
1
/
0
1
/
ZERO
async
def
gen
():
async
def
gen
():
nonlocal
DONE
nonlocal
DONE
...
@@ -1184,7 +1186,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
...
@@ -1184,7 +1186,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
await
asyncio
.
sleep
(
timeout
,
loop
=
self
.
loop
)
await
asyncio
.
sleep
(
timeout
,
loop
=
self
.
loop
)
yield
1
yield
1
finally
:
finally
:
1
/
0
1
/
ZERO
async
def
wait
():
async
def
wait
():
async
for
_
in
waiter
(
1
):
async
for
_
in
waiter
(
1
):
...
...
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