<commit_before>"""Tests for interface to `omega.games.gr1`."""
import logging
from tulip.spec import form
from tulip.interfaces import omega as omega_int
from tulip import synth


logging.getLogger('astutils').setLevel('ERROR')
logging.getLogger('omega.logic').setLevel('ERROR')


def test_grspec_to_automaton():
    sp = grspec_0()
    a = omega_int._grspec_to_automaton(sp)
    dvars = dict(x=dict(type='bool', owner='env', dom=None),
                 y=dict(type='bool', owner='sys', dom=None))
    assert a.vars == dvars, (a.vars, dvars)
    r = a.action['env']
    assert r == list(), r
    r = a.action['sys']
    assert r == ['( ( X x ) -> ( X y ) )'], r
    r = a.win['<>[]']
    assert r == ['!(( ! x ))'], r
    r = a.win['[]<>']
    assert r == ['( ! y )'], r


def test_synthesis_bool():
    sp = grspec_0()
    h = omega_int.synthesize_enumerated_streett(sp)
    g = synth.strategy2mealy(h, sp)<commit_msg>MAI: configure logging in `omega` test<commit_after>"""Tests for interface to `omega.games.gr1`."""
import logging
from tulip.spec import form
from tulip.interfaces import omega as omega_int
from tulip import synth


logging.getLogger('astutils').setLevel('ERROR')
logging.getLogger('omega').setLevel('ERROR')
log = logging.getLogger('omega.games')
log.setLevel('WARNING')
log.addHandler(logging.StreamHandler())


def test_grspec_to_automaton():
    sp = grspec_0()
    a = omega_int._grspec_to_automaton(sp)
    dvars = dict(x=dict(type='bool', owner='env', dom=None),
                 y=dict(type='bool', owner='sys', dom=None))
    assert a.vars == dvars, (a.vars, dvars)
    r = a.action['env']
    assert r == list(), r
    r = a.action['sys']
    assert r == ['( ( X x ) -> ( X y ) )'], r
    r = a.win['<>[]']
    assert r == ['!(( ! x ))'], r
    r = a.win['[]<>']
    assert r == ['( ! y )'], r


def test_synthesis_bool():
    sp = grspec_0()
    h = omega_int.synthesize_enumerated_streett(sp)
    g = synth.strategy2mealy(h, sp)
{'fraction_non_alphanumeric': 0.186734693877551, 'fraction_numerical': 0.004081632653061225, 'mean_word_length': 3.571095571095571, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4250048', 'n_tokens_mistral': 733, 'n_tokens_neox': 703, 'n_words': 162}