<commit_before>import praw
import re
from .helper import BJOTest
from bernard import actors
from mock import patch


class TestActor(BJOTest):
    def setUp(self):
        super().setUp()
        notifier = actors.Notifier('A notifcation', self.db, self.cur,
                                   self.subreddit)
        self.actor = actors.Actor(
            trigger=re.compile('foo', re.I),
            targets=[praw.models.Submission],
            remove=True,
            subactors=[notifier],
            action_name="Remove",
            action_details=None,
            db=self.db,
            cursor=self.cur,
            subreddit=self.subreddit
        )
    def test_match__correct_type(self):
        post = self.r.submission(id='5e7x7o')
        with self.recorder.use_cassette('TestActor.test_match__correct_type'):
            self.assertTrue(self.actor.match('foo', post))


    def test_match__incorrect_type(self):
        post = self.r.comment(id='dbnq46r')
        with self.recorder.use_cassette('TestActor.test_match__incorrect_type'):
            self.assertFalse(self.actor.match('foo', post))


    @patch('time.sleep', return_value=None)
    def test_parse(self, _):
        post = self.r.submission(id='5e7w80')
        with self.recorder.use_cassette('TestActor.test_parse'):
            self.actor.parse('foo', 'TGB', post)
            post = self.r.submission(id='5e7w80')
            self.assertIsNotNone(post.banned_by)
            self.assertTrue(post.locked)
            post_id = int('5e7w80', base=36)<commit_msg>Fix lint issue in test_actors.py<commit_after>import praw
import re
from .helper import BJOTest
from bernard import actors
from mock import patch


class TestActor(BJOTest):
    def setUp(self):
        super().setUp()
        notifier = actors.Notifier('A notifcation', self.db, self.cur,
                                   self.subreddit)
        self.actor = actors.Actor(
            trigger=re.compile('foo', re.I),
            targets=[praw.models.Submission],
            remove=True,
            subactors=[notifier],
            action_name="Remove",
            action_details=None,
            db=self.db,
            cursor=self.cur,
            subreddit=self.subreddit
        )

    def test_match__correct_type(self):
        post = self.r.submission(id='5e7x7o')
        with self.recorder.use_cassette('TestActor.test_match__correct_type'):
            self.assertTrue(self.actor.match('foo', post))


    def test_match__incorrect_type(self):
        post = self.r.comment(id='dbnq46r')
        with self.recorder.use_cassette('TestActor.test_match__incorrect_type'):
            self.assertFalse(self.actor.match('foo', post))


    @patch('time.sleep', return_value=None)
    def test_parse(self, _):
        post = self.r.submission(id='5e7w80')
        with self.recorder.use_cassette('TestActor.test_parse'):
            self.actor.parse('foo', 'TGB', post)
            post = self.r.submission(id='5e7w80')
            self.assertIsNotNone(post.banned_by)
            self.assertTrue(post.locked)
            post_id = int('5e7w80', base=36)
{'fraction_non_alphanumeric': 0.1198586118251928, 'fraction_numerical': 0.012210796915167094, 'mean_word_length': 2.3654054054054052, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7419448', 'n_tokens_mistral': 998, 'n_tokens_neox': 982, 'n_words': 149}