datacamp / sqlwhat

https://sqlwhat.readthedocs.io
GNU Affero General Public License v3.0
3 stars 8 forks source link

Allow has_equal_ast to pass if student AST contains solution #86

Closed machow closed 7 years ago

machow commented 7 years ago

Similar to pythonwhat. This will allow SCTs like

*** =solution

SELECT * 
FROM film
WHERE release_year = 2006
AND film_id < 5;

*** =sct


Ex().check_node('SelectStmt') \
    .check_field('where_clause') \
    .has_equal_ast(sql = "film_id < 5", start="expression", exact = False)

Note that we'll need to work out how to show CDs the names of parser rules in sqlwhat-viewer (so they can specify the start arg).