python: cleanup with autopep8
* tests/python/341.py, tests/python/alarm.py, tests/python/bdddict.py, tests/python/bddnqueen.py, tests/python/bugdet.py, tests/python/dualize.py, tests/python/except.py, tests/python/gen.py, tests/python/genem.py, tests/python/implies.py, tests/python/interdep.py, tests/python/ipnbdoctest.py, tests/python/kripke.py, tests/python/ltl2tgba.py, tests/python/ltlf.py, tests/python/ltlparse.py, tests/python/ltlsimple.py, tests/python/relabel.py, tests/python/rs_like.py, tests/python/sccsplit.py, tests/python/semidet.py, tests/python/setacc.py, tests/python/setxor.py, tests/python/split.py, tests/python/streett_totgba.py, tests/python/stutter.py, tests/python/sum.py, tests/python/toparity.py, tests/python/toweak.py, tests/python/trival.py, python/spot/__init__.py, python/spot/aux.py, python/spot/jupyter.py: Reformat with autopep8. fixup! * spot/tl/simplify.cc: Fix typos in tracing code.
This commit is contained in:
parent
5b01ce32dd
commit
822fe77891
33 changed files with 444 additions and 356 deletions
|
|
@ -27,32 +27,39 @@ m2 = spot.mark_t([2])
|
|||
m3 = spot.mark_t([3])
|
||||
mall = spot.mark_t()
|
||||
|
||||
|
||||
def test_rs(acc, rs, expected_res, expected_pairs):
|
||||
res, p = getattr(acc, 'is_' + rs + '_like')()
|
||||
assert res == expected_res
|
||||
if expected_res:
|
||||
expected_pairs.sort()
|
||||
p = sorted(p)
|
||||
for a,b in zip (p, expected_pairs):
|
||||
assert a.fin == b.fin and a.inf == b.inf
|
||||
res, p = getattr(acc, 'is_' + rs + '_like')()
|
||||
assert res == expected_res
|
||||
if expected_res:
|
||||
expected_pairs.sort()
|
||||
p = sorted(p)
|
||||
for a, b in zip(p, expected_pairs):
|
||||
assert a.fin == b.fin and a.inf == b.inf
|
||||
|
||||
|
||||
def switch_pairs(pairs):
|
||||
if pairs == None:
|
||||
return None
|
||||
r = []
|
||||
for p in pairs:
|
||||
r.append(spot.rs_pair(p.inf, p.fin))
|
||||
return r
|
||||
if pairs == None:
|
||||
return None
|
||||
r = []
|
||||
for p in pairs:
|
||||
r.append(spot.rs_pair(p.inf, p.fin))
|
||||
return r
|
||||
|
||||
|
||||
def test_streett(acc, expected_streett_like, expected_pairs):
|
||||
test_rs(acc, 'streett', expected_streett_like, expected_pairs)
|
||||
o_acc = spot.acc_cond(acc.get_acceptance().complement())
|
||||
test_rs(o_acc, 'rabin', expected_streett_like, switch_pairs(expected_pairs))
|
||||
test_rs(acc, 'streett', expected_streett_like, expected_pairs)
|
||||
o_acc = spot.acc_cond(acc.get_acceptance().complement())
|
||||
test_rs(o_acc, 'rabin', expected_streett_like,
|
||||
switch_pairs(expected_pairs))
|
||||
|
||||
|
||||
def test_rabin(acc, expected_rabin_like, expected_pairs):
|
||||
test_rs(acc, 'rabin', expected_rabin_like, expected_pairs)
|
||||
o_acc = spot.acc_cond(acc.get_acceptance().complement())
|
||||
test_rs(o_acc, 'streett', expected_rabin_like, switch_pairs(expected_pairs))
|
||||
test_rs(acc, 'rabin', expected_rabin_like, expected_pairs)
|
||||
o_acc = spot.acc_cond(acc.get_acceptance().complement())
|
||||
test_rs(o_acc, 'streett', expected_rabin_like,
|
||||
switch_pairs(expected_pairs))
|
||||
|
||||
|
||||
acc = spot.acc_cond(spot.acc_code('Fin(0)'))
|
||||
test_streett(acc, True, [spot.rs_pair(m0, mall)])
|
||||
|
|
@ -75,12 +82,12 @@ test_streett(acc, True, [spot.rs_pair(m0, m1), spot.rs_pair(m0, m2)])
|
|||
acc = spot.acc_cond(spot.acc_code('(Fin(0)|Inf(1))&(Fin(1)|Inf(2))'))
|
||||
test_streett(acc, True, [spot.rs_pair(m0, m1), spot.rs_pair(m1, m2)])
|
||||
|
||||
acc = spot.acc_cond(spot.acc_code('(Fin(0)|Inf(1))&(Fin(1)|Inf(2))'\
|
||||
acc = spot.acc_cond(spot.acc_code('(Fin(0)|Inf(1))&(Fin(1)|Inf(2))'
|
||||
'&(Fin(3)&Inf(3))'))
|
||||
test_streett(acc, True, [spot.rs_pair(m0, m1), spot.rs_pair(m1, m2),\
|
||||
spot.rs_pair(m3, mall), spot.rs_pair(mall, m3)])
|
||||
test_streett(acc, True, [spot.rs_pair(m0, m1), spot.rs_pair(m1, m2),
|
||||
spot.rs_pair(m3, mall), spot.rs_pair(mall, m3)])
|
||||
|
||||
acc = spot.acc_cond(spot.acc_code('(Fin(0)|Inf(1))&(Fin(1)|Inf(2))'\
|
||||
acc = spot.acc_cond(spot.acc_code('(Fin(0)|Inf(1))&(Fin(1)|Inf(2))'
|
||||
'&(Fin(3)&Inf(3))&(Fin(4)|Inf(5)|Inf(6))'))
|
||||
test_streett(acc, False, None)
|
||||
|
||||
|
|
@ -102,13 +109,11 @@ test_rabin(acc, True, [spot.rs_pair(m0, m1), spot.rs_pair(m0, m2)])
|
|||
acc = spot.acc_cond(spot.acc_code('(Fin(0)&Inf(1))|(Fin(1)&Inf(2))'))
|
||||
test_rabin(acc, True, [spot.rs_pair(m0, m1), spot.rs_pair(m1, m2)])
|
||||
|
||||
acc = spot.acc_cond(spot.acc_code('(Fin(0)&Inf(1))|(Fin(1)&Inf(2))'\
|
||||
acc = spot.acc_cond(spot.acc_code('(Fin(0)&Inf(1))|(Fin(1)&Inf(2))'
|
||||
'|(Fin(3)|Inf(3))'))
|
||||
test_rabin(acc, True, [spot.rs_pair(m0, m1), spot.rs_pair(m1, m2),\
|
||||
spot.rs_pair(m3, mall), spot.rs_pair(mall, m3)])
|
||||
test_rabin(acc, True, [spot.rs_pair(m0, m1), spot.rs_pair(m1, m2),
|
||||
spot.rs_pair(m3, mall), spot.rs_pair(mall, m3)])
|
||||
|
||||
acc = spot.acc_cond(spot.acc_code('(Fin(0)&Inf(1))|(Fin(1)&Inf(2))'\
|
||||
acc = spot.acc_cond(spot.acc_code('(Fin(0)&Inf(1))|(Fin(1)&Inf(2))'
|
||||
'|(Fin(3)|Inf(3))|(Fin(4)&Inf(5)&Inf(6))'))
|
||||
test_rabin(acc, False, None)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue