<commit_before>import unittest

from six.moves import http_client

import pygen


class HttpUpdaterTest(unittest.TestCase):
    def setUp(self):
        self.generate_count = 0

        self.app = pygen.PyGen(template='#testing', http=0)

        def counting_generate():
            self.generate_count += 1
            return 'Generated %d times' % self.generate_count

        self.app.generate = counting_generate

    def tearDown(self):
        self.app.stop()

    def test_http_post_triggers_update(self):
        response = self._call_updater()

        self.assertEqual(200, response.status)
        self.assertEqual('OK', response.read().strip())

        self.assertEqual(1, self.generate_count)

    def test_multiple_calls(self):
        self._call_updater()<commit_msg>Fixing 2/3 issue in unit tests<commit_after>import unittest

import six
from six.moves import http_client

import pygen


class HttpUpdaterTest(unittest.TestCase):
    def setUp(self):
        self.generate_count = 0

        self.app = pygen.PyGen(template='#testing', http=0)

        def counting_generate():
            self.generate_count += 1
            return 'Generated %d times' % self.generate_count

        self.app.generate = counting_generate

    def tearDown(self):
        self.app.stop()

    def test_http_post_triggers_update(self):
        response = self._call_updater()

        self.assertEqual(200, response.status)
        self.assertEqual(six.b('OK'), response.read().strip())

        self.assertEqual(1, self.generate_count)

    def test_multiple_calls(self):
        self._call_updater()
{'fraction_non_alphanumeric': 0.10230817217716781, 'fraction_numerical': 0.009981285090455396, 'mean_word_length': 2.8932038834951457, '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': '2614804', 'n_tokens_mistral': 489, 'n_tokens_neox': 469, 'n_words': 94}