예제 #1
0
def test_student_typed_no_ast():
    state_tst = prepare_state("SELECT * FROM x!!", "SELECT * FROM x!!")
    cf.test_student_typed(state_tst, "*", fixed=True)
예제 #2
0
def test_student_typed_upper_case_pass(state_tst):
    cf.test_student_typed(state_tst, "AND")
예제 #3
0
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)
예제 #4
0
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]")
예제 #5
0
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]")
예제 #6
0
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)
예제 #7
0
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)
예제 #8
0
def test_student_typed_itself_pass(state_tst):
    cf.test_student_typed(state_tst, text=state_tst.student_code, fixed=True)