def test_correct_regex2(correct_regex2, final_state2_a, final_state2_b, final_state2_c): final_state_a = get_final_state(correct_regex2, 'a') final_state_b = get_final_state(correct_regex2, 'b') final_state_c = get_final_state(correct_regex2, 'c') assert final_state_a == final_state2_a assert final_state_b == final_state2_b assert final_state_c == final_state2_c
def test_correct_regex1(correct_regex1, final_state1_a, final_state1_b, final_state1_c): final_state_a = get_final_state(correct_regex1, 'a') final_state_b = get_final_state(correct_regex1, 'b') final_state_c = get_final_state(correct_regex1, 'c') assert final_state_a == final_state1_a assert final_state_b == final_state1_b assert final_state_c == final_state1_c
def test_stack_not_empty(incorrect_regex_stack_not_empty): with pytest.raises(Exception) as excinfo: get_final_state(incorrect_regex_stack_not_empty, 'a') assert "inconsistent regular expression" in str(excinfo.value)
def test_unknown_symbol(incorrect_regex_unknown_symbol): with pytest.raises(Exception) as excinfo: get_final_state(incorrect_regex_unknown_symbol, 'a') assert "unexpected symbol" in str(excinfo.value)