<commit_before>import unittest

import django_fsu


class PatternTest(unittest.TestCase):
    url = '/user/<username>/post/<int:post>'

    def testQuotePattern(self):
        self.assertSequenceEqual(
            ['username', 'int:post'],
            django_fsu.quote.findall(self.url)
        )

    def testQuoteSplit(self):
        self.assertSequenceEqual(
            ['/user/', 'username', '/post/', 'int:post', ''],
            django_fsu.quote.split(self.url)
        )

    def testIntRegex(self):
        self.assertEqual(
            r'(?P<post>\d+)',
            django_fsu.make_regex('int:post')
        )

    def testStringRegex(self):
        self.assertEqual(
            r'(?P<username>[^\/]+)',
            django_fsu.make_regex('username')
        )

    # TODO: Test Full Regex


if __name__ == '__main__':
    unittest.main()<commit_msg>more tests<commit_after>import unittest
import re
import django_fsu


class PatternTest(unittest.TestCase):
    url = '/user/<username>/post/<int:post>'

    def testQuotePattern(self):
        self.assertSequenceEqual(
            ['username', 'int:post'],
            django_fsu.quote.findall(self.url)
        )

    def testQuoteSplit(self):
        self.assertSequenceEqual(
            ['/user/', 'username', '/post/', 'int:post', ''],
            django_fsu.quote.split(self.url)
        )

    def testIntRegex(self):
        self.assertEqual(
            r'(?P<post>\d+)',
            django_fsu.make_regex('int:post')
        )

    def testStringRegex(self):
        self.assertEqual(
            r'(?P<username>[^\/]+)',
            django_fsu.make_regex('username')
        )

    def _match(self, pat, tar):
        return re.match(django_fsu.route(pat), tar)

    def testRegexMatchText(self):
        self.assertTrue(self._match('<my_text>/', 'a string/'))

    def testRegexMatchInt(self):
        self.assertTrue(self._match('<int:my_int>/', '234532/'))

    def testRegexMatchFloat(self):
        self.assertTrue(self._match('<float:my_decimal>/', '234.35/'))

    def testRegexDoesntMatchFloatForInt(self):
        self.assertFalse(self._match('<int:my_int>/', '34.332/'))

    def testRegexMatchIntForFloat(self):
        self.assertTrue(self._match('<float:my_float>/', '2342/'))

    # TODO: Test Full Regex


if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.15647712697734073, 'fraction_numerical': 0.008550662676357419, 'mean_word_length': 2.4769687964338782, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '7015188', 'n_tokens_mistral': 770, 'n_tokens_neox': 738, 'n_words': 110}