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
b3a9cc06
Commit
b3a9cc06
authored
Jun 09, 2013
by
Joshua Roesslein
Browse files
Move cursors tests into its own module.
parent
40adbd9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
.travis.yml
View file @
b3a9cc06
---
script
:
nosetests -v tests.test_api tests.test_streaming
script
:
nosetests -v tests.test_api tests.test_streaming
tests.test_cursors
language
:
python
env
:
global
:
...
...
tests/test_api.py
View file @
b3a9cc06
...
...
@@ -312,43 +312,6 @@ class TweepyAPITests(unittest.TestCase):
self
.
assertTrue
(
place_name_in_list
(
'Austin, TX'
,
self
.
api
.
reverse_geocode
(
lat
=
30.267370168467806
,
long
=
-
97.74261474609375
)))
# Austin, TX, USA
class
TweepyCursorTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
auth
=
OAuthHandler
(
oauth_consumer_key
,
oauth_consumer_secret
)
auth
.
set_access_token
(
oauth_token
,
oauth_token_secret
)
self
.
api
=
API
(
auth
)
self
.
api
.
retry_count
=
2
self
.
api
.
retry_delay
=
5
def
testpagecursoritems
(
self
):
items
=
list
(
Cursor
(
self
.
api
.
user_timeline
).
items
())
self
.
assert_
(
len
(
items
)
>
0
)
items
=
list
(
Cursor
(
self
.
api
.
user_timeline
,
'twitter'
).
items
(
30
))
self
.
assert_
(
len
(
items
)
==
30
)
def
testpagecursorpages
(
self
):
pages
=
list
(
Cursor
(
self
.
api
.
user_timeline
).
pages
())
self
.
assert_
(
len
(
pages
)
>
0
)
pages
=
list
(
Cursor
(
self
.
api
.
user_timeline
,
'twitter'
).
pages
(
5
))
self
.
assert_
(
len
(
pages
)
==
5
)
def
testcursorcursoritems
(
self
):
items
=
list
(
Cursor
(
self
.
api
.
friends_ids
).
items
())
self
.
assert_
(
len
(
items
)
>
0
)
items
=
list
(
Cursor
(
self
.
api
.
followers_ids
,
'twitter'
).
items
(
30
))
self
.
assert_
(
len
(
items
)
==
30
)
def
testcursorcursorpages
(
self
):
pages
=
list
(
Cursor
(
self
.
api
.
friends_ids
).
pages
())
self
.
assert_
(
len
(
pages
)
>
0
)
pages
=
list
(
Cursor
(
self
.
api
.
followers_ids
,
'twitter'
).
pages
(
5
))
self
.
assert_
(
len
(
pages
)
==
5
)
class
TweepyCacheTests
(
unittest
.
TestCase
):
timeout
=
2.0
...
...
tests/test_cursors.py
0 → 100644
View file @
b3a9cc06
import
unittest
from
tweepy
import
API
,
Cursor
from
config
import
create_auth
class
TweepyCursorTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
api
=
API
(
create_auth
())
self
.
api
.
retry_count
=
2
self
.
api
.
retry_delay
=
5
def
testidcursoritems
(
self
):
items
=
list
(
Cursor
(
self
.
api
.
user_timeline
).
items
(
25
))
self
.
assertEqual
(
len
(
items
),
25
)
def
testidcursorpages
(
self
):
pages
=
list
(
Cursor
(
self
.
api
.
user_timeline
).
pages
(
5
))
self
.
assertEqual
(
len
(
pages
),
5
)
def
testcursorcursoritems
(
self
):
items
=
list
(
Cursor
(
self
.
api
.
friends_ids
).
items
())
self
.
assert_
(
len
(
items
)
>
0
)
items
=
list
(
Cursor
(
self
.
api
.
followers_ids
,
'twitter'
).
items
(
30
))
self
.
assert_
(
len
(
items
)
==
30
)
def
testcursorcursorpages
(
self
):
pages
=
list
(
Cursor
(
self
.
api
.
friends_ids
).
pages
())
self
.
assert_
(
len
(
pages
)
>
0
)
pages
=
list
(
Cursor
(
self
.
api
.
followers_ids
,
'twitter'
).
pages
(
5
))
self
.
assert_
(
len
(
pages
)
==
5
)
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