<commit_before>import logging
import os
from unittest.case import TestCase
from unittest.mock import Mock, patch

from ratelimitingfilter import RateLimitingFilter


class RateLimitingFilterTest(TestCase):
    def setUp(self):
        patcher = patch('ratelimitingfilter.ratelimitingfilter.time')
        self.mock_time = patcher.start()
        self.addCleanup(patcher.stop)
        self.mock_time.return_value = 0

    def test_limit_to_one_record_per_second(self):
        f = RateLimitingFilter(rate=1, per=1, burst=1)

        result = self._filter_twenty_records_over_two_seconds(f)<commit_msg>Use mock package for Python 2 compat.<commit_after>import logging
import os
from unittest.case import TestCase
from mock import Mock, patch

from ratelimitingfilter import RateLimitingFilter


class RateLimitingFilterTest(TestCase):
    def setUp(self):
        patcher = patch('ratelimitingfilter.ratelimitingfilter.time')
        self.mock_time = patcher.start()
        self.addCleanup(patcher.stop)
        self.mock_time.return_value = 0

    def test_limit_to_one_record_per_second(self):
        f = RateLimitingFilter(rate=1, per=1, burst=1)

        result = self._filter_twenty_records_over_two_seconds(f)
{'fraction_non_alphanumeric': 0.0757201646090535, 'fraction_numerical': 0.007407407407407408, 'mean_word_length': 4.264069264069264, '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': '5878817', 'n_tokens_mistral': 383, 'n_tokens_neox': 368, 'n_words': 77}