diff options
author | koljonen <koljonen@outlook.com> | 2016-06-14 22:44:36 +0200 |
---|---|---|
committer | koljonen <koljonen@outlook.com> | 2016-06-14 22:44:36 +0200 |
commit | b69404c21545baf024579fcba90b38f0418b85df (patch) | |
tree | 13e7e068d9a9ded93a2d072f3d0199ee4c493639 /tests/test_smart_completion_public_schema_only.py | |
parent | 6cb8c38628791e18dc5bf1a2a25c13497058c3eb (diff) |
Add a couple of tests suggested by @darikg
Diffstat (limited to 'tests/test_smart_completion_public_schema_only.py')
-rw-r--r-- | tests/test_smart_completion_public_schema_only.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_smart_completion_public_schema_only.py b/tests/test_smart_completion_public_schema_only.py index a097492c..3226484f 100644 --- a/tests/test_smart_completion_public_schema_only.py +++ b/tests/test_smart_completion_public_schema_only.py @@ -343,6 +343,22 @@ def test_suggested_join_conditions(completer, complete_event, text): Completion(text='u2.userid = u.id', start_position=0, display_meta='fk join')]) @pytest.mark.parametrize('text', [ + 'SELECT * FROM "Users" u JOIN u', + 'SELECT * FROM "Users" u JOIN uid', + 'SELECT * FROM "Users" u JOIN userid', + 'SELECT * FROM "Users" u JOIN id', +]) +def test_suggested_joins_fuzzy(completer, complete_event, text): + position = len(text) + result = set(completer.get_completions( + Document(text=text, cursor_position=position), + complete_event)) + last_word = text.split()[-1] + expected = Completion(text='users ON users.id = u.userid', + start_position=-len(last_word), display_meta='join') + assert expected in result + +@pytest.mark.parametrize('text', [ 'SELECT * FROM users JOIN ', '''SELECT * FROM users |