# Path: sismic/model/events.py
# class Event:
#     """
#     An event with a name and (optionally) some data passed as named parameters.
# 
#     The list of parameters can be obtained using *dir(event)*. Notice that
#     *name* and *data* are reserved names. If a *delay* parameter is provided,
#     then this event will be considered as a delayed event (and won't be
#     executed until given delay has elapsed).
# 
#     When two events are compared, they are considered equal if their names
#     and their data are equal.
# 
#     :param name: name of the event.
#     :param data: additional data passed as named parameters.
#     """
# 
#     __slots__ = ['name', 'data']
# 
#     def __init__(self, name: str, **additional_parameters: Any) -> None:
#         self.name = name
#         self.data = additional_parameters
# 
#     def __eq__(self, other):
#         if isinstance(other, Event):
#             return (self.name == other.name and self.data == other.data)
#         else:
#             return NotImplemented
# 
#     def __getattr__(self, attr):
#         try:
#             return self.data[attr]
#         except KeyError:
#             raise AttributeError('{} has no attribute {}'.format(self, attr))
# 
#     def __getstate__(self):
#         # For pickle and implicitly for multiprocessing
#         return self.name, self.data
# 
#     def __setstate__(self, state):
#         # For pickle and implicitly for multiprocessing
#         self.name, self.data = state
# 
#     def __hash__(self):
#         return hash(self.name)
# 
#     def __dir__(self):
#         return ['name'] + list(self.data.keys())
# 
#     def __repr__(self):
#         if self.data:
#             return '{}({!r}, {})'.format(
#                 self.__class__.__name__, self.name, ', '.join(
#                     '{}={!r}'.format(k, v) for k, v in self.data.items()))
#         else:
#             return '{}({!r})'.format(self.__class__.__name__, self.name)
# 
# class InternalEvent(Event):
#     """
#     Subclass of Event that represents an internal event.
#     """
#     pass
# 
# class MetaEvent(Event):
#     """
#     Subclass of Event that represents a MetaEvent, as used in property statecharts.
#     """
#     pass
# 
# Path: sismic/exceptions.py
# class PropertyStatechartError(SismicError):
#     """
#     Raised when a property statechart reaches a final state.
# 
#     :param property_statechart: the property statechart that reaches a final state
#     """
# 
#     def __init__(self, property_statechart):
#         super().__init__()
#         self._property = property_statechart
# 
#     @property
#     def property_statechart(self):
#         return self._property
# 
#     def __str__(self):
#         return '{}\nProperty is not satisfied, {} has reached a final state'.format(
#             self.__class__.__name__, self._property)


import pytest
from sismic.interpreter import Event, MetaEvent, InternalEvent
from sismic.exceptions import PropertyStatechartError

        # Bind it
        microwave.bind_property_statechart(None, interpreter_klass=prop_sc_call)

        return prop_sc

    def test_deprecated_interpreter(self, microwave):
        with pytest.warns(DeprecationWarning):
            microwave.bind_property_statechart(microwave)

    def test_synchronised_time(self, microwave, property_statechart):
        assert microwave.time == property_statechart.time
        microwave.clock.time += 10
        assert microwave.time == property_statechart.time

    def test_empty_step(self, microwave, property_statechart):
        microwave.execute()
        assert property_statechart.queue.call_args_list[0][0][0] == MetaEvent('step started', time=0)
        assert property_statechart.queue.call_args_list[-1][0][0] == MetaEvent('step ended')

        for call in property_statechart.queue.call_args_list:
            assert isinstance(call[0][0], MetaEvent)

    def test_event_sent(self, microwave, property_statechart):
        # Add send to a state
        state = microwave.statechart.state_for('door closed')
        state.on_entry = 'send("test")'

        microwave.execute()


# Path: sismic/model/events.py
# class Event:
#     """
#     An event with a name and (optionally) some data passed as named parameters.
# 
#     The list of parameters can be obtained using *dir(event)*. Notice that
#     *name* and *data* are reserved names. If a *delay* parameter is provided,
#     then this event will be considered as a delayed event (and won't be
#     executed until given delay has elapsed).
# 
#     When two events are compared, they are considered equal if their names
#     and their data are equal.
# 
#     :param name: name of the event.
#     :param data: additional data passed as named parameters.
#     """
# 
#     __slots__ = ['name', 'data']
# 
#     def __init__(self, name: str, **additional_parameters: Any) -> None:
#         self.name = name
#         self.data = additional_parameters
# 
#     def __eq__(self, other):
#         if isinstance(other, Event):
#             return (self.name == other.name and self.data == other.data)
#         else:
#             return NotImplemented
# 
#     def __getattr__(self, attr):
#         try:
#             return self.data[attr]
#         except KeyError:
#             raise AttributeError('{} has no attribute {}'.format(self, attr))
# 
#     def __getstate__(self):
#         # For pickle and implicitly for multiprocessing
#         return self.name, self.data
# 
#     def __setstate__(self, state):
#         # For pickle and implicitly for multiprocessing
#         self.name, self.data = state
# 
#     def __hash__(self):
#         return hash(self.name)
# 
#     def __dir__(self):
#         return ['name'] + list(self.data.keys())
# 
#     def __repr__(self):
#         if self.data:
#             return '{}({!r}, {})'.format(
#                 self.__class__.__name__, self.name, ', '.join(
#                     '{}={!r}'.format(k, v) for k, v in self.data.items()))
#         else:
#             return '{}({!r})'.format(self.__class__.__name__, self.name)
# 
# class InternalEvent(Event):
#     """
#     Subclass of Event that represents an internal event.
#     """
#     pass
# 
# class MetaEvent(Event):
#     """
#     Subclass of Event that represents a MetaEvent, as used in property statecharts.
#     """
#     pass
# 
# Path: sismic/exceptions.py
# class PropertyStatechartError(SismicError):
#     """
#     Raised when a property statechart reaches a final state.
# 
#     :param property_statechart: the property statechart that reaches a final state
#     """
# 
#     def __init__(self, property_statechart):
#         super().__init__()
#         self._property = property_statechart
# 
#     @property
#     def property_statechart(self):
#         return self._property
# 
#     def __str__(self):
#         return '{}\nProperty is not satisfied, {} has reached a final state'.format(
#             self.__class__.__name__, self._property)


# Path: tests/test_property.py
import pytest
from sismic.interpreter import Event, MetaEvent, InternalEvent
from sismic.exceptions import PropertyStatechartError


        # Bind it
        microwave.bind_property_statechart(None, interpreter_klass=prop_sc_call)

        return prop_sc

    def test_deprecated_interpreter(self, microwave):
        with pytest.warns(DeprecationWarning):
            microwave.bind_property_statechart(microwave)

    def test_synchronised_time(self, microwave, property_statechart):
        assert microwave.time == property_statechart.time
        microwave.clock.time += 10
        assert microwave.time == property_statechart.time

    def test_empty_step(self, microwave, property_statechart):
        microwave.execute()
        assert property_statechart.queue.call_args_list[0][0][0] == MetaEvent('step started', time=0)
        assert property_statechart.queue.call_args_list[-1][0][0] == MetaEvent('step ended')

        for call in property_statechart.queue.call_args_list:
            assert isinstance(call[0][0], MetaEvent)

    def test_event_sent(self, microwave, property_statechart):
        # Add send to a state
        state = microwave.statechart.state_for('door closed')
        state.on_entry = 'send("test")'

        microwave.execute()


        assert MetaEvent('event sent', event=InternalEvent('test')) in [x[0][0] for x in property_statechart.queue.call_args_list]