Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
02a43b7f
Commit
02a43b7f
authored
May 19, 2013
by
Joshua Roesslein
Browse files
Add test for Stream.filter().
parent
a592b1b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_streaming.py
View file @
02a43b7f
...
...
@@ -20,6 +20,10 @@ class MockStreamListener(StreamListener):
if
self
.
connect_cb
:
self
.
connect_cb
()
def
on_timeout
(
self
):
self
.
test_case
.
fail
(
'timeout'
)
return
False
def
on_status
(
self
,
status
):
self
.
status_count
+=
1
self
.
test_case
.
assertIsInstance
(
status
,
Status
)
...
...
@@ -30,7 +34,7 @@ class TweepyStreamTests(unittest.TestCase):
def
setUp
(
self
):
self
.
auth
=
create_auth
()
self
.
listener
=
MockStreamListener
(
self
)
self
.
stream
=
Stream
(
self
.
auth
,
self
.
listener
)
self
.
stream
=
Stream
(
self
.
auth
,
self
.
listener
,
timeout
=
3.0
)
def
tearDown
(
self
):
self
.
stream
.
disconnect
()
...
...
@@ -51,3 +55,10 @@ class TweepyStreamTests(unittest.TestCase):
self
.
assertEquals
(
self
.
listener
.
status_count
,
self
.
listener
.
status_stop_count
)
def
test_filter_track
(
self
):
self
.
listener
.
status_stop_count
=
5
phrases
=
[
'twitter'
]
self
.
stream
.
filter
(
track
=
phrases
)
self
.
assertEquals
(
self
.
listener
.
status_count
,
self
.
listener
.
status_stop_count
)
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