<commit_before>
import unittest

from maildaemon.config import load_config
from maildaemon.imap_daemon import IMAPDaemon
from maildaemon.message_filter import MessageFilter


class Tests(unittest.TestCase):

    config = load_config()

    @unittest.skip('temporary')
    def test_apply(self):

        c = IMAPDaemon.from_dict(self.config['connections']['gmail-imap'])

        c.connect()

        msg = c.retrieve_message(1)

        f = MessageFilter.from_dict(self.config['filters']['facebook'], {'gmail-imap': c})
        result = f.applies_to(msg)
        self.assertIsInstance(result, bool, msg=(f, msg))

        c.disconnect()
<commit_msg>dummy test for message filter<commit_after>
import typing as t
import unittest

from maildaemon.config import load_config
from maildaemon.imap_daemon import IMAPDaemon
from maildaemon.message_filter import MessageFilter


class Tests(unittest.TestCase):

    config = load_config()

    def test_construct(self):
        def func1(arg: str):
            return True
        def func2(arg: t.Any):
            return
        conn = None  # type: Connection
        connections = [conn]
        msg_filter = MessageFilter(connections, [[('aa', func1)]], [func2])
        self.assertIsNotNone(msg_filter)

    @unittest.skip('temporary')
    def test_apply(self):

        c = IMAPDaemon.from_dict(self.config['connections']['gmail-imap'])

        c.connect()

        msg = c.retrieve_message(1)

        f = MessageFilter.from_dict(self.config['filters']['facebook'], {'gmail-imap': c})
        result = f.applies_to(msg)
        self.assertIsInstance(result, bool, msg=(f, msg))

        c.disconnect()

{'fraction_non_alphanumeric': 0.11796733212341198, 'fraction_numerical': 0.003629764065335753, 'mean_word_length': 3.241025641025641, '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': '1525458', 'n_tokens_mistral': 523, 'n_tokens_neox': 498, 'n_words': 107}