Example #1
0
def assert_outcomes(fsa, events, expected_outcomes, ordered=True, timestamps=None):
    if timestamps:
        pairs = zip(events, timestamps)
        tokens = fsa.feed_all_timestamps(pairs)
    else:
        tokens = fsa.feed_all(events)
    got = [ token['state'] for token in tokens ]
    if ordered:
        assert_equal(expected_outcomes, got)
    else:
        assert_set_equal(set(expected_outcomes), set(got))
    LOG.debug("---")
Example #2
0
def assert_matches(fsa, events, expected_matches, ordered=True, timestamps=None):
    if timestamps:
        pairs = zip(events, timestamps)
        tokens = fsa.feed_all_timestamps(pairs)
    else:
        tokens = fsa.feed_all(events)
    got = [ "".join(token['history_events']) for token in tokens ]
    if ordered:
        assert_equal(expected_matches, got)
    else:
        assert_set_equal(set(expected_matches), set(got))
    LOG.debug("---")