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
d80fe1e1
Commit
d80fe1e1
authored
Aug 24, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test__greenlet.py: check that __str__ works the same after greenlet's exited
parent
ba67c148
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
greentest/test__greenlet.py
greentest/test__greenlet.py
+27
-6
No files found.
greentest/test__greenlet.py
View file @
d80fe1e1
...
...
@@ -489,13 +489,34 @@ class A(object):
hexobj
=
re
.
compile
(
'0x[0123456789abcdef]+'
)
class
TestStr
(
greentest
.
TestCase
):
switch_expected
=
False
def
test
(
self
):
g1
=
gevent
.
Greenlet
(
test_func
)
self
.
assertEqual
(
hexobj
.
sub
(
'X'
,
str
(
g1
)),
'<Greenlet at X: test_func>'
)
g2
=
gevent
.
Greenlet
(
A
().
method
)
self
.
assertEqual
(
hexobj
.
sub
(
'X'
,
str
(
g2
)),
'<Greenlet at X: <bound method A.method of <__main__.A object at X>>>'
)
def
test_function
(
self
):
g
=
gevent
.
Greenlet
.
spawn
(
test_func
)
self
.
assertEqual
(
hexobj
.
sub
(
'X'
,
str
(
g
)),
'<Greenlet at X: test_func>'
)
assert_not_ready
(
g
)
g
.
join
()
assert_ready
(
g
)
self
.
assertEqual
(
hexobj
.
sub
(
'X'
,
str
(
g
)),
'<Greenlet at X: test_func>'
)
def
test_method
(
self
):
g
=
gevent
.
Greenlet
.
spawn
(
A
().
method
)
self
.
assertEqual
(
hexobj
.
sub
(
'X'
,
str
(
g
)),
'<Greenlet at X: <bound method A.method of <__main__.A object at X>>>'
)
assert_not_ready
(
g
)
g
.
join
()
assert_ready
(
g
)
self
.
assertEqual
(
hexobj
.
sub
(
'X'
,
str
(
g
)),
'<Greenlet at X: <bound method A.method of <__main__.A object at X>>>'
)
def
assert_ready
(
g
):
assert
g
.
dead
,
g
assert
g
.
ready
(),
g
assert
not
bool
(
g
),
g
def
assert_not_ready
(
g
):
assert
not
g
.
dead
,
g
assert
not
g
.
ready
(),
g
X
=
object
()
...
...
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