forked from bear/python-twitter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_streaming.py
More file actions
29 lines (20 loc) · 1.09 KB
/
test_streaming.py
File metadata and controls
29 lines (20 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import json
import unittest
import twitter
def test_streaming_extended_tweet():
with open('testdata/streaming/streaming_extended_tweet.json') as f:
tweet = twitter.Status.NewFromJsonDict(json.loads(f.read()))
assert isinstance(tweet, twitter.Status)
assert tweet.text == "HIV_AIDS_BiojQuery Mobile Web Development Essentials, Second Edition: https://t.co/r78h6xfAby Quantum AI Big/Small/… https://t.co/ZPJrpMvcZG"
assert tweet.truncated
assert tweet.full_text == 'HIV_AIDS_BiojQuery Mobile Web Development Essentials, Second Edition: https://t.co/r78h6xfAby Quantum AI Big/Small/0 Data Cloud/Fog Computing OutLook from ClouData & Multiverse - https://t.co/cnCBNJvu6T'
def test_streaming_extended_tweet_media():
with open('testdata/streaming/lines.json') as f:
tweets = f.readlines()
for tweet in tweets:
status = twitter.Status.NewFromJsonDict(json.loads(tweet))
assert isinstance(status, twitter.Status)
assert status.full_text