Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit fbaf200

Browse files
committed
fix tests v2
1 parent 626db1b commit fbaf200

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/test_sanity.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ def test_metadata_multipic():
153153

154154
def _test_get_tweet(results):
155155
assert results
156-
assert results[0]["full_text"] == "If you're interacting with Twitter via Python, I'd recommend Python Twitter Tools by @sixohsix https://github.com/sixohsix/twitter"
156+
if "data" in results:
157+
results = results["data"]
158+
assert len(results)
159+
result = results[0]
160+
assert result.get("full_text", result.get("text")) == "If you're interacting with Twitter via Python, I'd recommend Python Twitter Tools by @sixohsix https://github.com/sixohsix/twitter"
157161

158162

159163
def test_get_tweet():
@@ -165,11 +169,11 @@ def test_get_tweet_app_auth():
165169

166170

167171
def test_get_tweet_v2():
168-
_test_get_tweet(twitter2.tweets(ids='27095053386121216', format='detailed', expansions='attachments.poll_ids,attachments.media_keys,author_id,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id'))
172+
_test_get_tweet(twitter2.tweets(ids='27095053386121216', params={"tweet.fields": "text"}))
169173

170174

171175
def test_get_tweet_v2_app_auth():
172-
_test_get_tweet(twitter2_app.tweets(ids='27095053386121216', format='detailed', expansions='attachments.poll_ids,attachments.media_keys,author_id,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id'))
176+
_test_get_tweet(twitter2_app.tweets(ids='27095053386121216', params={"tweet.fields": "text"}))
173177

174178

175179
def test_search():

0 commit comments

Comments
 (0)