Commit 19cd2cda authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

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.
parent cbb2e64e
......@@ -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.
......
......@@ -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().
......
......@@ -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"
......
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment