Python nltk.compat.TemporaryDirectory() Examples

The following are code examples for showing how to use nltk.compat.TemporaryDirectory(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_textoutput(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.text.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.text.csv')
            json2csv(self.infile, outfn, ['text'], gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 2
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.tweet.csv.ref')
        fields = ['created_at', 'favorite_count', 'id',
                  'in_reply_to_status_id', 'in_reply_to_user_id', 'retweet_count',
                  'retweeted', 'text', 'truncated', 'user.id']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.tweet.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 3
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_user_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.user.csv.ref')
        fields = ['id', 'text', 'user.id', 'user.followers_count', 'user.friends_count']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.user.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 4
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_hashtag(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.hashtag.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.hashtag.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'hashtags', ['text'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 5
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_usermention(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.usermention.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.usermention.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'user_mentions', ['id', 'screen_name'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 6
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_url(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.url.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.url.csv')
            json2csv_entities(self.infile, outfn,
                              ['id'], 'urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 7
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_userurl(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.userurl.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.userurl.csv')
            json2csv_entities(self.infile, outfn, ['id', 'screen_name'],
                              'user.urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 8
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_place(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.place.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.place.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'place', ['name', 'country'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 9
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_place_boundingbox(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.placeboundingbox.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.placeboundingbox.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'name'], 'place.bounding_box', ['coordinates'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 10
Project: razzy-spinner   Author: rafasashi   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_retweet_original_tweet(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.retweet.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.retweet.csv')
            json2csv_entities(self.infile, outfn, ['id'], 'retweeted_status',
                              ['created_at', 'favorite_count', 'id', 'in_reply_to_status_id',
                               'in_reply_to_user_id', 'retweet_count', 'text', 'truncated',
                               'user.id'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 11
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_textoutput(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.text.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.text.csv')
            json2csv(self.infile, outfn, ['text'], gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 12
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.tweet.csv.ref')
        fields = ['created_at', 'favorite_count', 'id',
                  'in_reply_to_status_id', 'in_reply_to_user_id', 'retweet_count',
                  'retweeted', 'text', 'truncated', 'user.id']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.tweet.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 13
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_user_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.user.csv.ref')
        fields = ['id', 'text', 'user.id', 'user.followers_count', 'user.friends_count']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.user.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 14
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_hashtag(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.hashtag.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.hashtag.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'hashtags', ['text'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 15
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_usermention(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.usermention.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.usermention.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'user_mentions', ['id', 'screen_name'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 16
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_url(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.url.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.url.csv')
            json2csv_entities(self.infile, outfn,
                              ['id'], 'urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 17
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_userurl(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.userurl.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.userurl.csv')
            json2csv_entities(self.infile, outfn, ['id', 'screen_name'],
                              'user.urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 18
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_place(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.place.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.place.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'place', ['name', 'country'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 19
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_place_boundingbox(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.placeboundingbox.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.placeboundingbox.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'name'], 'place.bounding_box', ['coordinates'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 20
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_retweet_original_tweet(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.retweet.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.retweet.csv')
            json2csv_entities(self.infile, outfn, ['id'], 'retweeted_status',
                              ['created_at', 'favorite_count', 'id', 'in_reply_to_status_id',
                               'in_reply_to_user_id', 'retweet_count', 'text', 'truncated',
                               'user.id'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 21
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_textoutput(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.text.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.text.csv')
            json2csv(self.infile, outfn, ['text'], gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 22
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.tweet.csv.ref')
        fields = ['created_at', 'favorite_count', 'id',
                  'in_reply_to_status_id', 'in_reply_to_user_id', 'retweet_count',
                  'retweeted', 'text', 'truncated', 'user.id']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.tweet.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 23
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_user_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.user.csv.ref')
        fields = ['id', 'text', 'user.id', 'user.followers_count', 'user.friends_count']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.user.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 24
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_hashtag(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.hashtag.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.hashtag.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'hashtags', ['text'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 25
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_usermention(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.usermention.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.usermention.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'user_mentions', ['id', 'screen_name'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 26
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_url(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.url.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.url.csv')
            json2csv_entities(self.infile, outfn,
                              ['id'], 'urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 27
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_userurl(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.userurl.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.userurl.csv')
            json2csv_entities(self.infile, outfn, ['id', 'screen_name'],
                              'user.urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 28
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_place(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.place.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.place.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'place', ['name', 'country'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 29
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_place_boundingbox(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.placeboundingbox.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.placeboundingbox.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'name'], 'place.bounding_box', ['coordinates'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 30
Project: OpenBottle   Author: xiaozhuchacha   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_retweet_original_tweet(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.retweet.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.retweet.csv')
            json2csv_entities(self.infile, outfn, ['id'], 'retweeted_status',
                              ['created_at', 'favorite_count', 'id', 'in_reply_to_status_id',
                               'in_reply_to_user_id', 'retweet_count', 'text', 'truncated',
                               'user.id'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 31
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_textoutput(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.text.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.text.csv')
            json2csv(self.infile, outfn, ['text'], gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 32
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.tweet.csv.ref')
        fields = ['created_at', 'favorite_count', 'id',
                  'in_reply_to_status_id', 'in_reply_to_user_id', 'retweet_count',
                  'retweeted', 'text', 'truncated', 'user.id']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.tweet.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 33
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_user_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.user.csv.ref')
        fields = ['id', 'text', 'user.id', 'user.followers_count', 'user.friends_count']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.user.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 34
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_hashtag(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.hashtag.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.hashtag.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'hashtags', ['text'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 35
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_usermention(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.usermention.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.usermention.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'user_mentions', ['id', 'screen_name'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 36
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_url(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.url.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.url.csv')
            json2csv_entities(self.infile, outfn,
                              ['id'], 'urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 37
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_userurl(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.userurl.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.userurl.csv')
            json2csv_entities(self.infile, outfn, ['id', 'screen_name'],
                              'user.urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 38
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_place(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.place.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.place.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'place', ['name', 'country'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 39
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_tweet_place_boundingbox(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.placeboundingbox.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.placeboundingbox.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'name'], 'place.bounding_box', ['coordinates'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 40
Project: Health-Checker   Author: KriAga   File: test_json2csv_corpus.py    MIT License 5 votes vote down vote up
def test_retweet_original_tweet(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.retweet.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.retweet.csv')
            json2csv_entities(self.infile, outfn, ['id'], 'retweeted_status',
                              ['created_at', 'favorite_count', 'id', 'in_reply_to_status_id',
                               'in_reply_to_user_id', 'retweet_count', 'text', 'truncated',
                               'user.id'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 41
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_textoutput(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.text.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.text.csv')
            json2csv(self.infile, outfn, ['text'], gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 42
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.tweet.csv.ref')
        fields = ['created_at', 'favorite_count', 'id',
                  'in_reply_to_status_id', 'in_reply_to_user_id', 'retweet_count',
                  'retweeted', 'text', 'truncated', 'user.id']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.tweet.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 43
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_user_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.user.csv.ref')
        fields = ['id', 'text', 'user.id', 'user.followers_count', 'user.friends_count']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.user.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 44
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_hashtag(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.hashtag.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.hashtag.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'hashtags', ['text'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 45
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_usermention(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.usermention.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.usermention.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'user_mentions', ['id', 'screen_name'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 46
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_url(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.url.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.url.csv')
            json2csv_entities(self.infile, outfn,
                              ['id'], 'urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 47
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_userurl(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.userurl.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.userurl.csv')
            json2csv_entities(self.infile, outfn, ['id', 'screen_name'],
                              'user.urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 48
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_place(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.place.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.place.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'place', ['name', 'country'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 49
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_place_boundingbox(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.placeboundingbox.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.placeboundingbox.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'name'], 'place.bounding_box', ['coordinates'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 50
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_retweet_original_tweet(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.retweet.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.retweet.csv')
            json2csv_entities(self.infile, outfn, ['id'], 'retweeted_status',
                              ['created_at', 'favorite_count', 'id', 'in_reply_to_status_id',
                               'in_reply_to_user_id', 'retweet_count', 'text', 'truncated',
                               'user.id'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 51
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_textoutput(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.text.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.text.csv')
            json2csv(self.infile, outfn, ['text'], gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 52
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.tweet.csv.ref')
        fields = ['created_at', 'favorite_count', 'id',
                  'in_reply_to_status_id', 'in_reply_to_user_id', 'retweet_count',
                  'retweeted', 'text', 'truncated', 'user.id']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.tweet.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 53
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_user_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.user.csv.ref')
        fields = ['id', 'text', 'user.id', 'user.followers_count', 'user.friends_count']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.user.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 54
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_hashtag(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.hashtag.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.hashtag.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'hashtags', ['text'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 55
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_usermention(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.usermention.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.usermention.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'user_mentions', ['id', 'screen_name'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 56
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_url(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.url.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.url.csv')
            json2csv_entities(self.infile, outfn,
                              ['id'], 'urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 57
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_userurl(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.userurl.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.userurl.csv')
            json2csv_entities(self.infile, outfn, ['id', 'screen_name'],
                              'user.urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 58
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_place(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.place.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.place.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'place', ['name', 'country'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 59
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_place_boundingbox(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.placeboundingbox.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.placeboundingbox.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'name'], 'place.bounding_box', ['coordinates'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 60
Project: honours_project   Author: JFriel   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_retweet_original_tweet(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.retweet.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.retweet.csv')
            json2csv_entities(self.infile, outfn, ['id'], 'retweeted_status',
                              ['created_at', 'favorite_count', 'id', 'in_reply_to_status_id',
                               'in_reply_to_user_id', 'retweet_count', 'text', 'truncated',
                               'user.id'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 61
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_textoutput(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.text.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.text.csv')
            json2csv(self.infile, outfn, ['text'], gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 62
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.tweet.csv.ref')
        fields = ['created_at', 'favorite_count', 'id',
                  'in_reply_to_status_id', 'in_reply_to_user_id', 'retweet_count',
                  'retweeted', 'text', 'truncated', 'user.id']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.tweet.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 63
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_user_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.user.csv.ref')
        fields = ['id', 'text', 'user.id', 'user.followers_count', 'user.friends_count']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.user.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 64
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_hashtag(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.hashtag.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.hashtag.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'hashtags', ['text'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 65
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_usermention(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.usermention.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.usermention.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'user_mentions', ['id', 'screen_name'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 66
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_url(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.url.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.url.csv')
            json2csv_entities(self.infile, outfn,
                              ['id'], 'urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 67
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_userurl(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.userurl.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.userurl.csv')
            json2csv_entities(self.infile, outfn, ['id', 'screen_name'],
                              'user.urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 68
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_place(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.place.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.place.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'place', ['name', 'country'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 69
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_tweet_place_boundingbox(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.placeboundingbox.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.placeboundingbox.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'name'], 'place.bounding_box', ['coordinates'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 70
Project: aop-helpFinder   Author: jecarvaill   File: test_json2csv_corpus.py    GNU General Public License v3.0 5 votes vote down vote up
def test_retweet_original_tweet(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.retweet.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.retweet.csv')
            json2csv_entities(self.infile, outfn, ['id'], 'retweeted_status',
                              ['created_at', 'favorite_count', 'id', 'in_reply_to_status_id',
                               'in_reply_to_user_id', 'retweet_count', 'text', 'truncated',
                               'user.id'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 71
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_textoutput(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.text.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.text.csv')
            json2csv(self.infile, outfn, ['text'], gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 72
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_tweet_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.tweet.csv.ref')
        fields = ['created_at', 'favorite_count', 'id',
                  'in_reply_to_status_id', 'in_reply_to_user_id', 'retweet_count',
                  'retweeted', 'text', 'truncated', 'user.id']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.tweet.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 73
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_user_metadata(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.user.csv.ref')
        fields = ['id', 'text', 'user.id', 'user.followers_count', 'user.friends_count']

        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.user.csv')
            json2csv(self.infile, outfn, fields, gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 74
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_tweet_hashtag(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.hashtag.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.hashtag.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'hashtags', ['text'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 75
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_tweet_usermention(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.usermention.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.usermention.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'user_mentions', ['id', 'screen_name'],
                              gzip_compress=False)
            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 76
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_tweet_url(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.url.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.url.csv')
            json2csv_entities(self.infile, outfn,
                              ['id'], 'urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 77
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_userurl(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.userurl.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.userurl.csv')
            json2csv_entities(self.infile, outfn, ['id', 'screen_name'],
                              'user.urls', ['url', 'expanded_url'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 78
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_tweet_place(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.place.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.place.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'text'], 'place', ['name', 'country'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 79
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_tweet_place_boundingbox(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.placeboundingbox.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.placeboundingbox.csv')
            json2csv_entities(self.infile, outfn,
                              ['id', 'name'], 'place.bounding_box', ['coordinates'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg) 
Example 80
Project: serverless-chatbots-workshop   Author: datteswararao   File: test_json2csv_corpus.py    Apache License 2.0 5 votes vote down vote up
def test_retweet_original_tweet(self):
        ref_fn = os.path.join(self.subdir, 'tweets.20150430-223406.retweet.csv.ref')
        with TemporaryDirectory() as tempdir:
            outfn = os.path.join(tempdir, 'tweets.20150430-223406.retweet.csv')
            json2csv_entities(self.infile, outfn, ['id'], 'retweeted_status',
                              ['created_at', 'favorite_count', 'id', 'in_reply_to_status_id',
                               'in_reply_to_user_id', 'retweet_count', 'text', 'truncated',
                               'user.id'],
                              gzip_compress=False)

            self.assertTrue(are_files_identical(outfn, ref_fn), msg=self.msg)