<commit_before># -*- encoding: utf-8 -*-

from twisted.internet.defer import inlineCallbacks

from globaleaks.tests import helpers
from globaleaks.jobs import statistics_sched
from globaleaks.settings import GLSetting, external_counted_events

class TestEmail(helpers.TestGL):

    def increment_accesses(self, amount):

        for element in external_counted_events.keys():
            GLSetting.anomalies_counter[element] = amount

    @inlineCallbacks
    def test_anomalies(self):

        yield helpers.TestGL.setUp(self)

        print "First round 10"
        self.increment_accesses(10)
        statistics_sched.AnomaliesSchedule().operation()

        print "Second round 30"
        self.increment_accesses(30)
        statistics_sched.AnomaliesSchedule().operation()

        print "Third round 30"
        self.increment_accesses(30)
        statistics_sched.AnomaliesSchedule().operation()

        print "Stats!"
        yield statistics_sched.StatisticsSchedule().operation()



<commit_msg>Don't pollute the unittest output with verbose prints of some unittest.<commit_after># -*- encoding: utf-8 -*-

from twisted.internet.defer import inlineCallbacks

from globaleaks.tests import helpers
from globaleaks.jobs import statistics_sched
from globaleaks.settings import GLSetting, external_counted_events

class TestEmail(helpers.TestGL):

    def increment_accesses(self, amount):

        for element in external_counted_events.keys():
            GLSetting.anomalies_counter[element] = amount

    @inlineCallbacks
    def test_anomalies(self):
        yield helpers.TestGL.setUp(self)
        # First round 10
        self.increment_accesses(10)
        statistics_sched.AnomaliesSchedule().operation()
        # Second round 30
        self.increment_accesses(30)
        statistics_sched.AnomaliesSchedule().operation()
        # Third round 30
        self.increment_accesses(30)
        statistics_sched.AnomaliesSchedule().operation()
        # Stats!
        yield statistics_sched.StatisticsSchedule().operation()

{'fraction_non_alphanumeric': 0.08137254901960785, 'fraction_numerical': 0.012745098039215686, 'mean_word_length': 3.4177489177489178, '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': '4493095', 'n_tokens_mistral': 594, 'n_tokens_neox': 554, 'n_words': 122}