<commit_before>#!/usr/bin/env python

import pytest

from circuits import Component, Event


class Foo(Event):
    """Foo Event"""


class Bar(Event):
    """Bar Event"""

class Bar2(Event):
    """Bar Event"""


class BarDone(Event):
    """fired when Bar is done"""


class Test(Component):

    def test_wait_class(self):
        x = self.fire(Bar())
        self.waitEvent(Bar, 30)
        return x.value

    def test_wait_instance(self):
        e = Bar()
        x = self.fire(e)
        self.waitEvent(e, 30)
        return x.value

    def test_call_event(self):
        e = Bar()
        x = self.callEvent(e)
        return x.value

    def bar(self):
        self.push(BarDone())
        return "Foobar!"


def test_wait_class():
    test = Test()
    test.start()

    x = test.fire(Foo(), "test_wait_class")
    pytest.wait_event(test, "bardone")

    value = x.value
    assert value == "Foobar!"

    test.stop()


def test_wait_instance():
    test = Test()
    test.start()

    e = Foo()
    x = test.fire(e, "test_wait_instance")
    pytest.wait_event(test, "bardone")

    value = x.value
    assert value == "Foobar!"

    test.stop()


def test_call_event():
    test = Test()
    test.start()

    e = Foo()
    x = test.fire(e, "test_call_event")
    pytest.wait_event(test, "bardone")

    value = x.value
    assert value == "Foobar!"

    test.stop()<commit_msg>added test_greenlet for callEvent returning a null value<commit_after>#!/usr/bin/env python

import pytest

from circuits import Component, Event


class Foo(Event):
    """Foo Event"""


class Bar(Event):
    """Bar Event"""

class Bar2(Event):
    """Bar Event"""


class BarDone(Event):
    """fired when Bar is done"""


class Test(Component):

    def test_wait_class(self):
        x = self.fire(Bar())
        self.waitEvent(Bar, 30)
        return x.value

    def test_wait_instance(self):
        e = Bar()
        x = self.fire(e)
        self.waitEvent(e, 30)
        return x.value

    def test_call_event(self):
        e = Bar()
        x = self.callEvent(e)
        return x.value

    def test_call_event2(self):
        e = Bar2()
        x = self.callEvent(e)
        return x.value

    def bar(self):
        self.push(BarDone())
        return "Foobar!"

    def bar2(self):
        self.push(BarDone())
        return


def test_wait_class():
    test = Test()
    test.start()

    x = test.fire(Foo(), "test_wait_class")
    pytest.wait_event(test, "bardone")

    value = x.value
    assert value == "Foobar!"

    test.stop()


def test_wait_instance():
    test = Test()
    test.start()

    e = Foo()
    x = test.fire(e, "test_wait_instance")
    pytest.wait_event(test, "bardone")

    value = x.value
    assert value == "Foobar!"

    test.stop()


def test_call_event():
    test = Test()
    test.start()

    e = Foo()
    x = test.fire(e, "test_call_event")
    pytest.wait_event(test, "bardone")

    value = x.value
    assert value == "Foobar!"

    x = test.fire(e, "test_call_event2")
    pytest.wait_event(test, "bardone")

    value = x.value
    assert value == None

    test.stop()
{'fraction_non_alphanumeric': 0.14166666666666666, 'fraction_numerical': 0.004487179487179487, 'mean_word_length': 2.3740540540540542, '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': '2200487', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1060, 'n_words': 254}