Commit 0f3bc27d authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

python: fix bindings for scc_filter as a method

* wrap/python/spot.py: Fix bindings for scc_filter.
* wrap/python/tests/remfin.py: Test them.
parent c7d063aa
...@@ -540,9 +540,14 @@ def postprocess(automaton, *args): ...@@ -540,9 +540,14 @@ def postprocess(automaton, *args):
twa.postprocess = postprocess twa.postprocess = postprocess
twa.scc_filter = scc_filter
twa.scc_filter_states = scc_filter_states
# Wrap C++-functions into lambdas so that they get converted into
# 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'):
setattr(twa_graph, meth, (lambda self, *args, **kwargs:
globals()[meth](self, *args, **kwargs)))
# Wrapper around a formula iterator to which we add some methods of formula # Wrapper around a formula iterator to which we add some methods of formula
# (using _addfilter and _addmap), so that we can write things like # (using _addfilter and _addmap), so that we can write things like
......
...@@ -20,8 +20,8 @@ State: 2 ...@@ -20,8 +20,8 @@ State: 2
""") """)
aut.prop_inherently_weak() aut.prop_inherently_weak()
aut = spot.dtwa_complement(aut) aut = spot.dtwa_complement(aut)
aut = spot.scc_filter_states(aut) aut1 = spot.scc_filter_states(aut)
assert(aut.to_str('hoa') == """HOA: v1 assert(aut1.to_str('hoa') == """HOA: v1
States: 2 States: 2
Start: 0 Start: 0
AP: 1 "a" AP: 1 "a"
...@@ -36,6 +36,8 @@ State: 1 ...@@ -36,6 +36,8 @@ State: 1
[t] 1 [t] 1
--END--""") --END--""")
assert(aut.get_name() == None) assert(aut.scc_filter_states().to_str() == aut1.to_str())
aut.set_name("test me") assert(aut1.get_name() == None)
assert(aut.get_name() == "test me") aut1.set_name("test me")
assert(aut1.get_name() == "test me")
# The method is the same as the function
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