<commit_before>import time
import unittest
import threading

import synapse.sched as s_sched

class SchedTest(unittest.TestCase):

    def test_sched_base(self):

        evt = threading.Event()
        data = {'woot':[]}
        def woot1(x):
            data['woot'].append(x)

        def woot2(x):
            data['woot'].append(x)
            evt.set()

        sched = s_sched.Sched()

        sched.insec( 0.02, woot2, 20 )
        sched.insec( 0.01, woot1, 10 )

        evt.wait()

        self.assertListEqual( data['woot'], [10,20] )

        sched.fini()

    def test_sched_cancel(self):
        sched = s_sched.Sched()

        def woot2(x):
            pass

        eid = sched.insec( 20, woot2, 20 )
        sched.cancel(eid)

        sched.fini()

    def test_sched_persec(self):
        sched = s_sched.Sched()

        evt = threading.Event()<commit_msg>added check for event.is_set() in unit test<commit_after>import time
import unittest
import threading

import synapse.sched as s_sched

class SchedTest(unittest.TestCase):

    def test_sched_base(self):

        evt = threading.Event()
        data = {'woot':[]}
        def woot1(x):
            data['woot'].append(x)

        def woot2(x):
            data['woot'].append(x)
            evt.set()

        sched = s_sched.Sched()

        sched.insec( 0.02, woot2, 20 )
        sched.insec( 0.01, woot1, 10 )

        evt.wait(timeout=2)

        self.assertTrue( evt.is_set() )

        self.assertListEqual( data['woot'], [10,20] )

        sched.fini()

    def test_sched_cancel(self):
        sched = s_sched.Sched()

        def woot2(x):
            pass

        eid = sched.insec( 20, woot2, 20 )
        sched.cancel(eid)

        sched.fini()

    def test_sched_persec(self):
        sched = s_sched.Sched()

        evt = threading.Event()
{'fraction_non_alphanumeric': 0.1277292576419214, 'fraction_numerical': 0.026746724890829694, 'mean_word_length': 1.928115015974441, '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': '7458462', 'n_tokens_mistral': 674, 'n_tokens_neox': 618, 'n_words': 127}