Skip to content

Commit

Permalink
Whitespaces in event parameters used in BDD steps are stripped before…
Browse files Browse the repository at this point in the history
… they are evaluated.
  • Loading branch information
AlexandreDecan committed Apr 26, 2018
1 parent 6536d89 commit 09d1681
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

1.1.0 (2018-04-26)
------------------

- (Fixed) Whitespaces in event parameters used in BDD steps are stripped before they are evaluated.


1.1.0 (2018-04-23)
------------------

Expand Down
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@ of `many contributors <http://sismic.readthedocs.io/en/master/authors.html>`_.

Sismic is released publicly under the `GNU Lesser General Public Licence version 3.0 (LGPLv3)
<http://www.gnu.org/licenses/lgpl-3.0.html>`_.

You can cite Sismic using:

.. code::
@software{sismic,
author = {{Alexandre Decan}},
title = {Sismic Interactive Statechart Model Interpreter and Checker},
url = {https://github.com/AlexandreDecan/sismic},
}
18 changes: 16 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,28 @@ Sismic statecharts provides full support for the majority of the UML 2 statechar
api


Source code
-----------
Credits
-------

The Sismic library for Python
is mainly developed by Alexandre Decan at the `University of Mons <http://www.umons.ac.be>`_ with the help
of `many contributors <http://sismic.readthedocs.io/en/master/authors.html>`_.

Sismic is released publicly under the `GNU Lesser General Public Licence version 3.0 (LGPLv3)
<http://www.gnu.org/licenses/lgpl-3.0.html>`_.

The source code is available on GitHub:
https://github.com/AlexandreDecan/sismic

Use GitHub's integrated services to contribute suggestions and feature requests for this library or to report bugs.

You can cite Sismic using:

.. code::
@software{sismic,
author = {{Alexandre Decan}},
title = {Sismic Interactive Statechart Model Interpreter and Checker},
url = {https://github.com/AlexandreDecan/sismic},
}
8 changes: 4 additions & 4 deletions sismic/bdd/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def send_event(context, name, parameter=None, value=None):
parameters = {}
if context.table:
for row in context.table:
parameters[row['parameter']] = eval(row['value'], {}, {})
parameters[row['parameter'].strip()] = eval(row['value'].strip(), {}, {})

if parameter and value:
parameters[parameter] = eval(value)
parameters[parameter.strip()] = eval(value.strip(), {}, {})

event = Event(name, **parameters)
context.interpreter.queue(event)
Expand Down Expand Up @@ -125,10 +125,10 @@ def event_is_fired(context, name, parameter=None, value=None):
parameters = {}

for row in context.table if context.table else []:
parameters[row['parameter']] = eval(row['value'], {}, {})
parameters[row['parameter'].strip()] = eval(row['value'].strip(), {}, {})

if parameter and value:
parameters[parameter] = eval(value)
parameters[parameter.strip()] = eval(value.strip(), {}, {})

for macrostep in context.monitored_trace:
for event in macrostep.sent_events:
Expand Down
2 changes: 1 addition & 1 deletion sismic/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def context(self):
def __str__(self): # pragma: no cover
message = [
'{}'.format(self.__class__.__name__),
'Property statechart: {}'.format(self._property),
'Property is not satisfied, {} has reached a final state'.format(self._property),
'Configuration: {}'.format(self._configuration),
'Step: {}'.format(self._step),
'Context:'
Expand Down

0 comments on commit 09d1681

Please sign in to comment.