示例#1
0
 def test_add_to_wordnik_test_mode(self):
     # Arrange
     words = ["one", "two"]
     wordlist_permalink = "test--47"
     # Enable test mode
     word_tools.TEST_MODE = True
     # Act
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#2
0
 def test_add_to_wordnik_test_mode(self):
     # Arrange
     words = ["one", "two"]
     wordlist_permalink = "test--47"
     # Enable test mode
     word_tools.TEST_MODE = True
     # Act
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#3
0
                        help='CSV file location for storing matching tweets')
    args = parser.parse_args()

    word_tools.init_twitter(OAUTH_TOKEN, OAUTH_SECRET, CONSUMER_KEY,
                            CONSUMER_SECRET)
    STUFF = word_tools.load_ini(args.ini, STUFF)  # updates STUFF[1]

    for i, search_term in enumerate(STUFF[0]):
        STUFF[1][i], results = word_tools.get_words_from_twitter(
            search_term, STUFF[1][i])
        words = word_tools.find_words(search_term,
                                      TARGET_WORD_FOLLOWS_SEARCH_TERM, results,
                                      args.csv)

        if not TEST_MODE:
            word_tools.add_to_wordnik(words, STUFF[2][i])

        tweet_prefix = STUFF[0][i].replace("I ", "Tweeters ")
        if "love" in STUFF[0][i]:
            tweet_prefix = u"\u2665 " + tweet_prefix  # heart
        else:
            tweet_prefix = u"\u2020 " + tweet_prefix  # dagger

        if args.tweet == "random":
            from random import choice
            # exclude none and random:
            args.tweet = choice(word_tools.TWEET_CHOICES[1:-2])
            print("Random tweet type:" + args.tweet)

        word_tools.tweet_those(words, tweet_prefix, args.csv, search_term,
                               args.tweet)
示例#4
0
    word_tools.TEST_MODE = args.dry_run

    word_tools.init_twitter(OAUTH_TOKEN, OAUTH_SECRET, CONSUMER_KEY, CONSUMER_SECRET)
    STUFF = word_tools.load_ini(args.ini, STUFF)  # updates STUFF[1]

    for i, search_term in enumerate(STUFF[0]):
        STUFF[1][i], results = word_tools.get_words_from_twitter(
            search_term, STUFF[1][i]
        )
        words = word_tools.find_words(
            search_term, TARGET_WORD_FOLLOWS_SEARCH_TERM, results, args.csv
        )

        if not args.dry_run:
            word_tools.add_to_wordnik(words, STUFF[2][i])

        tweet_prefix = STUFF[0][i].replace("is my ", "Twitter's ")
        tweet_prefix = u"\u2605 " + tweet_prefix  # heart

        if args.tweet == "random":
            from random import choice

            # exclude none and random:
            args.tweet = choice(word_tools.TWEET_CHOICES[1:-2])
            print("Random tweet type:" + args.tweet)

        word_tools.tweet_those(words, tweet_prefix, args.csv, search_term, args.tweet)

        word_tools.save_ini(args.ini, STUFF)
示例#5
0
 def test_add_nothing_to_wordnik(self):
     # Arrange
     words = []
     wordlist_permalink = "test--47"
     # Act
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#6
0
 def test_add_mix_to_wordnik(self):
     words = ['string4', u'unicode4']
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#7
0
 def test_add_unicodes_to_wordnik(self):
     words = [u'unicode2', u'unicode3']
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#8
0
 def test_add_strings_to_wordnik(self):
     words = ['string2', 'string3']
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#9
0
 def OFF_test_add_mix_to_wordnik(self):
     words = ["string4", u"unicode4"]
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#10
0
 def test_add_nothing_to_wordnik(self):
     # Arrange
     words = []
     wordlist_permalink = "test--47"
     # Act
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#11
0
 def test_add_unicodes_to_wordnik(self):
     words = [u"unicode2", u"unicode3"]
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#12
0
 def OFF_test_add_strings_to_wordnik(self):
     words = ["string2", "string3"]
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#13
0
 def test_add_mix_to_wordnik(self):
     words = ['string4', u'unicode4']
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#14
0
 def test_add_unicode_to_wordnik(self):
     words = [u'unicode']
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)
示例#15
0
 def test_add_strings_to_wordnik(self):
     words = ['string2', 'string3']
     wordlist_permalink = "test--47"
     word_tools.add_to_wordnik(words, wordlist_permalink)