Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test_bql.py less brittle and easier to maintain #564

Open
fsaad opened this issue Jun 24, 2017 · 0 comments
Open

Make test_bql.py less brittle and easier to maintain #564

fsaad opened this issue Jun 24, 2017 · 0 comments

Comments

@fsaad
Copy link
Collaborator

fsaad commented Jun 24, 2017

test_bql.py is over 2500 lines of tests, its purpose is to test the BQL -> SQL compiler.

The content of the tests themselves is fine, but the string comparison pattern assert bql2sql(...) == '...' is very difficult to maintain, because:

  • the string comaprison is sensitive to whitespace, which can be very difficult to debug when there is a single error,

  • python requires '' to break lines, which means we end up with tests like this:

    assert bql2sql('infer rowid, age, weight with confidence 0.9 from p1') \
        == \
        'SELECT "rowid" AS "rowid",' \
        ' "IFNULL"("age", bql_predict(1, NULL, NULL, _rowid_, 2, 0.9, NULL))' \
            ' AS "age",' \
        ' "IFNULL"("weight",'\
                ' bql_predict(1, NULL, NULL, _rowid_, 3, 0.9, NULL))' \
            ' AS "weight"' \
        ' FROM "t1";'

which is fine if the test never needs to be updated, but when the interface of bql_predict changes to have .e.g more arguments, the line becomes long and needs to be broken, leading to a very slow update process.

fsaad pushed a commit that referenced this issue Jun 25, 2017
Herculian effort required to updated tests/test_bql.py filed as ticket:
#564.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant