Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
gevent
Commits
02fa58e5
Commit
02fa58e5
authored
Apr 03, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test__core_watcher.py
parent
708e0fd1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
greentest/test__core_watcher.py
greentest/test__core_watcher.py
+52
-0
No files found.
greentest/test__core_watcher.py
0 → 100644
View file @
02fa58e5
import
sys
import
gevent
import
unittest
class
Test
(
unittest
.
TestCase
):
def
test_types
(
self
):
loop
=
gevent
.
core
.
loop
()
lst
=
[]
io
=
loop
.
timer
(
0.01
)
# test that cannot pass non-callable thing to start()
self
.
assertRaises
(
TypeError
,
io
.
start
,
None
)
self
.
assertRaises
(
TypeError
,
io
.
start
,
5
)
# test that cannot set 'callback' to non-callable thing later either
io
.
start
(
lambda
*
args
:
lst
.
append
(
args
))
self
.
assertEqual
(
io
.
args
,
())
try
:
io
.
callback
=
None
raise
AssertionError
(
'"io.callback = None" must raise TypeError'
)
except
TypeError
:
pass
try
:
io
.
callback
=
5
raise
AssertionError
(
'"io.callback = 5" must raise TypeError'
)
except
TypeError
:
pass
# test that args can be changed later
io
.
args
=
(
1
,
2
,
3
)
# test that only tuple and None are accepted by 'args' attribute
try
:
io
.
args
=
5
raise
AssertionError
(
'"io.args = 5" must raise TypeError'
)
except
TypeError
:
pass
self
.
assertEqual
(
io
.
args
,
(
1
,
2
,
3
))
try
:
io
.
args
=
[
4
,
5
]
raise
AssertionError
(
'"io.args = [4, 5]" must raise TypeError'
)
except
TypeError
:
pass
self
.
assertEqual
(
io
.
args
,
(
1
,
2
,
3
))
# None also works, means empty tuple
io
.
args
=
None
loop
.
run
()
self
.
assertEqual
(
lst
,
[()])
if
__name__
==
'__main__'
:
unittest
.
main
()
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