<commit_before>from django.core.management.base import BaseCommand, CommandError

from bot.tests.tweet import main


class Command(BaseCommand):
    help = 'Test the bot'
    
    def add_arguments(self, parser):
        parser.add_argument('hashtag', type=str)
    
    def handle(self, *args, **options):
        hashtag = options['hashtag']
        main(hashtag)
        self.stdout.write(self.style.SUCCESS('Done testing tweet.'))<commit_msg>improve testing retweet<commit_after>from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from bot.tests.tweet import main
import logging

logger = logging.getLogger(__name__)

class Command(BaseCommand):
    help = 'Test retweeting by the bot'
    
    def add_arguments(self, parser):
        parser.add_argument('hashtag', type=str, nargs='*')
    
    def handle(self, *args, **options):
        opt = options['hashtag']
        hashtag_lst = []
        if not opt:
            hashtag_lst = settings.KEYWORD_RETWEET_LIST
        elif isinstance(opt, list):
            hashtag_lst.extend(opt)
        else:
            hashtag_lst.append(opt)

        for hashtag in hashtag_lst:
            main(hashtag)
        self.stdout.write(self.style.SUCCESS('Done testing retweet.'))
{'fraction_non_alphanumeric': 0.10369206598586017, 'fraction_numerical': 0.0, 'mean_word_length': 3.0189274447949526, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4811735', 'n_tokens_mistral': 386, 'n_tokens_neox': 378, 'n_words': 88}