<commit_before>from django.test import TestCase

from soapbox.models import Message


class MessageTests(TestCase):
    fixtures = ['soapboxtest.json']

    def test_active(self):
        # Fixture has four active messages.
        self.assertEqual(Message.objects.active().count(), 4)

    def test_match_simple(self):
        # Should match the global and the '/bar/' messages.
        results = Message.objects.match('/bar/')
        self.assertEqual(len(results), 2)

    def test_match_partial(self):
        # Should match the global, the '/foo/' and the '/foo/bar/'
        # messages.
        results = Message.objects.match('/foo/bar/')
        self.assertEqual(len(results), 3)

    def test_match_global(self):
        # Should match only the global message.
        results = Message.objects.match('/')
        self.assertEqual(len(results), 1)
<commit_msg>Finish testing the Message model.<commit_after>from django.test import TestCase

from soapbox.models import Message


class MessageTests(TestCase):
    fixtures = ['soapboxtest.json']

    def test_active(self):
        # Fixture has four active messages.
        self.assertEqual(Message.objects.active().count(), 4)

    def test_match_simple(self):
        # Should match the global and the '/bar/' messages.
        results = Message.objects.match('/bar/')
        self.assertEqual(len(results), 2)

    def test_match_partial(self):
        # Should match the global, the '/foo/' and the '/foo/bar/'
        # messages.
        results = Message.objects.match('/foo/bar/')
        self.assertEqual(len(results), 3)

    def test_match_global(self):
        # Should match only the global message.
        results = Message.objects.match('/')
        self.assertEqual(len(results), 1)

    def test_match_none(self):
        # This should also match only the global message.
        results = Message.objects.match('/fo/')
        self.assertEqual(len(results), 1)

{'fraction_non_alphanumeric': 0.11919504643962849, 'fraction_numerical': 0.0046439628482972135, 'mean_word_length': 2.779727095516569, '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': '1650491', 'n_tokens_mistral': 548, 'n_tokens_neox': 526, 'n_words': 144}