python: add binding for is_unambiguous

Fixes #117.

* wrap/python/spot.py, wrap/python/spot_impl.i: Add binding.
* wrap/python/tests/remfin.py: Add a small test case.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2015-11-05 13:41:42 +01:00
parent cbb2e64e7c
commit 19cd2cda6f
4 changed files with 16 additions and 1 deletions

3
NEWS
View file

@ -22,6 +22,9 @@ New in spot 1.99.5a (not yet released)
Boolean argument. This argument used to be optionnal (defaulting
to True), but it no longer is.
Python:
* Add bindings for is_unambiguous().
Bug fixes:
* automaton parser was ignoring the "unambiguous" property.

View file

@ -626,10 +626,14 @@ twa.postprocess = postprocess
# instance methods (i.e., self passed as first argument
# automatically), because only used-defined functions are converted as
# instance methods.
for meth in ('scc_filter', 'scc_filter_states'):
def _add_twa_graph(meth):
setattr(twa_graph, meth, (lambda self, *args, **kwargs:
globals()[meth](self, *args, **kwargs)))
for meth in ('scc_filter', 'scc_filter_states',
'is_deterministic', 'is_unambiguous'):
_add_twa_graph(meth)
# Wrapper around a formula iterator to which we add some methods of formula
# (using _addfilter and _addmap), so that we can write things like
# formulas.simplify().is_X_free().

View file

@ -128,6 +128,7 @@
#include "twaalgos/sccfilter.hh"
#include "twaalgos/stats.hh"
#include "twaalgos/isdet.hh"
#include "twaalgos/isunamb.hh"
#include "twaalgos/simulation.hh"
#include "twaalgos/postproc.hh"
#include "twaalgos/product.hh"
@ -307,6 +308,7 @@ namespace std {
%include "twaalgos/sccfilter.hh"
%include "twaalgos/stats.hh"
%include "twaalgos/isdet.hh"
%include "twaalgos/isunamb.hh"
%include "twaalgos/simulation.hh"
%include "twaalgos/postproc.hh"
%include "twaalgos/product.hh"

View file

@ -41,3 +41,9 @@ assert(aut1.get_name() == None)
aut1.set_name("test me")
assert(aut1.get_name() == "test me")
# The method is the same as the function
a = spot.translate('true', 'low', 'any')
assert(a.prop_deterministic() == False)
assert(a.prop_unambiguous() == False)
assert(a.is_deterministic() == True)
assert(a.is_unambiguous() == True)