# 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)
# 
# Path: sismic/testing.py
# def state_is_entered(steps: MacroSteps, name: str) -> bool:
# def state_is_exited(steps: MacroSteps, name: str) -> bool:
# def event_is_fired(
#         steps: MacroSteps, name: Optional[str],
#         parameters: Mapping[str, Any] = None) -> bool:
# def event_is_consumed(
#         steps: MacroSteps, name: Optional[str],
#         parameters: Mapping[str, Any] = None) -> bool:
# def transition_is_processed(steps: MacroSteps, transition: Optional[Transition] = None) -> bool:
# def expression_holds(interpreter: Interpreter, expression: str) -> bool:


import pytest
import os
from subprocess import check_call
from sismic.interpreter import Event
from sismic import testing

    def test_floor_selection(self, elevator):
        # Stabilisation
        elevator.execute_once()

        elevator.queue('floorSelected', floor=4).execute_once()
        assert elevator.context['destination'] == 4

        elevator.execute_once()
        assert set(elevator.configuration) == {'active', 'active', 'doorsClosed', 'floorListener', 'floorSelecting', 'movingElevator'}

    def test_floor_selected_and_reached(self, elevator):
        # Stabilisation
        elevator.execute_once()

        elevator.queue('floorSelected', floor=4).execute()
        assert elevator.context['current'] == 4

        elevator.clock.time += 10
        elevator.execute()

        assert 'doorsOpen' in elevator.configuration
        assert elevator.context['current'] == 0


class TestRemoteElevator:
    def test_button(self, elevator, remote_elevator):
        assert elevator.context['current'] == 0

        steps = remote_elevator.queue('button_2_pushed').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)
# 
# Path: sismic/testing.py
# def state_is_entered(steps: MacroSteps, name: str) -> bool:
# def state_is_exited(steps: MacroSteps, name: str) -> bool:
# def event_is_fired(
#         steps: MacroSteps, name: Optional[str],
#         parameters: Mapping[str, Any] = None) -> bool:
# def event_is_consumed(
#         steps: MacroSteps, name: Optional[str],
#         parameters: Mapping[str, Any] = None) -> bool:
# def transition_is_processed(steps: MacroSteps, transition: Optional[Transition] = None) -> bool:
# def expression_holds(interpreter: Interpreter, expression: str) -> bool:


# Path: tests/test_examples.py
import pytest
import os
from subprocess import check_call
from sismic.interpreter import Event
from sismic import testing


    def test_floor_selection(self, elevator):
        # Stabilisation
        elevator.execute_once()

        elevator.queue('floorSelected', floor=4).execute_once()
        assert elevator.context['destination'] == 4

        elevator.execute_once()
        assert set(elevator.configuration) == {'active', 'active', 'doorsClosed', 'floorListener', 'floorSelecting', 'movingElevator'}

    def test_floor_selected_and_reached(self, elevator):
        # Stabilisation
        elevator.execute_once()

        elevator.queue('floorSelected', floor=4).execute()
        assert elevator.context['current'] == 4

        elevator.clock.time += 10
        elevator.execute()

        assert 'doorsOpen' in elevator.configuration
        assert elevator.context['current'] == 0


class TestRemoteElevator:
    def test_button(self, elevator, remote_elevator):
        assert elevator.context['current'] == 0

        steps = remote_elevator.queue('button_2_pushed').execute()

        assert testing.event_is_fired(steps, 'floorSelected', {'floor': 2})