dbcli/litecli

Test failure with sqlparse==0.4.3

vlaci opened this issue · 0 comments

vlaci commented

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 = <litecli.sqlcompleter.SQLCompleter object at 0x7f156ee04c10>
complete_event = <Mock id='139730031234208'>

    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 = <Mock id='139730031234208'>
completer  = <litecli.sqlcompleter.SQLCompleter object at 0x7f156ee04c10>
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 andialbrecht/sqlparse@c1a597e