-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added retweet/quoted skipping and TweetReader unit tests
- Loading branch information
Alexandra DeLucia
committed
Sep 1, 2020
1 parent
e28c697
commit 92a6652
Showing
2 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Tests for littlebird/tweet_utils.py | ||
Author: Alexandra DeLucia | ||
""" | ||
import unittest | ||
from typing import List, Dict, Any | ||
|
||
import littlebird | ||
from littlebird import TweetReader | ||
from littlebird import TweetWriter | ||
|
||
|
||
class TestTweetReader(unittest.TestCase): | ||
def test_file_not_found(self): | ||
with self.assertRaises(SystemExit): | ||
reader = TweetReader("does_not_exist.json") | ||
|
||
def test_skip_retweets(self): | ||
reader = TweetReader("demo_tweets.json") | ||
for tweet in reader.read_tweets(skip_retweeted_and_quoted=True): | ||
self.assertEqual(tweet.get("retweeted_status", False), False) | ||
self.assertEqual(tweet.get("quoted_status", False), False) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
|
||
|