dbcli / litecli

CLI for SQLite Databases with auto-completion and syntax highlighting
https://litecli.com
BSD 3-Clause "New" or "Revised" License
2.06k stars 67 forks source link

Test failure with sqlparse==0.4.3 #153

Open vlaci opened 1 year ago

vlaci commented 1 year ago

With srqlparse 0.4.3 tests/test_smart_completion_public_schema_only.py::test_auto_escaped_col_names test fails

Pytest output ``` ============================= test session starts ============================== platform linux -- Python 3.10.9, pytest-7.2.1, pluggy-1.0.0 -- /tmp/tmp.Tb95zRlr01/litecli/.venv/bin/python cachedir: .pytest_cache rootdir: /tmp/tmp.Tb95zRlr01/litecli, configfile: setup.cfg plugins: cov-4.0.0 collecting ... collected 1 item tests/test_smart_completion_public_schema_only.py::test_auto_escaped_col_names FAILED [100%] =================================== FAILURES =================================== _________________________ test_auto_escaped_col_names __________________________ completer = complete_event = def test_auto_escaped_col_names(completer, complete_event): text = "SELECT from `select`" position = len("SELECT ") result = list( completer.get_completions( Document(text=text, cursor_position=position), complete_event ) ) > assert ( result == [ Completion(text="*", start_position=0), Completion(text="`ABC`", start_position=0), Completion(text="`insert`", start_position=0), Completion(text="id", start_position=0), ] + list(map(Completion, completer.functions)) + [Completion(text="`select`", start_position=0)] + list(map(Completion, sorted(completer.keywords))) ) E AssertionError: assert [Completion(t...AVG')])), ...] == [Completion(t...AVG')])), ...] E At index 72 diff: Completion(text='select', start_position=0, display=FormattedText([('', 'select')])) != Completion(text='`select`', start_position=0, display=FormattedText([('', '`select`')])) E Full diff: E [ E Completion(text='*', start_position=0, display=FormattedText([('', '*')])), E Completion(text='`ABC`', start_position=0, display=FormattedText([('', '`ABC`')])), E Completion(text='`insert`', start_position=0, display=FormattedText([('', '`insert`')])), E Completion(text='id', start_position=0, display=FormattedText([('', 'id')])),... E E ...Full output truncated (236 lines hidden), use '-vv' to show complete_event = completer = position = 7 result = [Completion(text='*', start_position=0, display=FormattedText([('', '*')])), Completion(text='`ABC`', start_position=0...lay=FormattedText([('', 'ABS')])), Completion(text='AVG', start_position=0, display=FormattedText([('', 'AVG')])), ...] text = 'SELECT from `select`' tests/test_smart_completion_public_schema_only.py:370: AssertionError =============================== warnings summary =============================== tests/conftest.py:9 /tmp/tmp.Tb95zRlr01/litecli/tests/conftest.py:9: PytestDeprecationWarning: @pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same. @pytest.yield_fixture(scope="function") -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED tests/test_smart_completion_public_schema_only.py::test_auto_escaped_col_names ========================= 1 failed, 1 warning in 0.06s ========================= ```

The issue is introduced by https://github.com/andialbrecht/sqlparse/commit/c1a597ee6e8e22c94ca5bdfa1c6665453e0d2c25