def test_student_typed_no_ast(): state_tst = prepare_state("SELECT * FROM x!!", "SELECT * FROM x!!") cf.test_student_typed(state_tst, "*", fixed=True)
def test_student_typed_upper_case_pass(state_tst): cf.test_student_typed(state_tst, "AND")
def test_student_typed_fixed_star_pass(): state_tst = prepare_state("SELECT * FROM x", "SELECT * FROM x") cf.test_student_typed(state_tst, "*", fixed=True)
def test_student_typed_subset_re_pass(state_tst): select = check_node(state_tst, "SelectStmt", 0) where = check_field(select, "where_clause") with pytest.raises(TF): cf.test_student_typed(where, "id > [a-z]")
def test_student_typed_subset_re_pass(state_tst): select = check_node(state_tst, "SelectStmt", 0) where = check_field(select, "where_clause") cf.test_student_typed(where, "id > [0-9]")
def test_student_typed_fixed_subset_fail(state_tst): select = check_node(state_tst, "SelectStmt", 0) where = check_field(select, "where_clause") with pytest.raises(TF): cf.test_student_typed(where, "WHERE id > 4", fixed=True)
def test_student_typed_fixed_subset_fail(state_tst): select = check_node(state_tst, "SelectStmt", 0) # should fail because the select statement does not include ';' with pytest.raises(TF): cf.test_student_typed(state_tst, state_tst.student_code, fixed=True)
def test_student_typed_itself_pass(state_tst): cf.test_student_typed(state_tst, text=state_tst.student_code, fixed=True)