datacamp / pythonwhat

Verify Python code submissions and auto-generate meaningful feedback messages.
http://pythonwhat.readthedocs.io/
GNU Affero General Public License v3.0
69 stars 31 forks source link

Correct submission throws `(sqlite3.ProgrammingError)`: block date: June 23 #32

Closed hugobowne closed 8 years ago

hugobowne commented 8 years ago

https://campus.datacamp.com/courses/1167/2629?ex=8

screenshot 2016-06-18 14 50 35

it's weird because this error doesn't show up in any other SQL exercises.

vvnkr commented 8 years ago
# Tests for the context manager body
def test_with_body():

    # Test: call to con.execute() and 'rs' variable
    test_object("rs", do_eval = False)
    test_function("con.execute")

    # Test: call to pd.DataFrame() and 'df' variable
    test_correct(
        lambda: test_object_after_expression("df"),
        lambda: test_function("pandas.DataFrame", do_eval = False)
    )

     # Test: call to rs.keys() and df.columns
    test_correct(
        lambda: test_expression_result(expr_code = "df.columns"),
        lambda: test_function("rs.keys")
    )

# Test: Context manager
test_with(
    1,
    context_vals = True,
    context_tests = lambda: test_function("engine.connect"),
    body = test_with_body
)

# Test: Predefined code
predef_msg = "You don't have to change any of the predefined code."
test_function("print", index = 1, incorrect_msg = predef_msg)
test_function("print", index = 2, incorrect_msg = predef_msg)

success_msg("Awesome!")