Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Upcoming (TBD)
Bug Fixes
---------
* Respect `history_file` setting in the `[main]` section of `~/.myclirc`.
* Adapt test suite to pygments v2.20.0.


1.72.1 (2026/05/11)
Expand All @@ -12,7 +13,6 @@ Bug Fixes
Bug Fixes
---------
* Update `sqlglot` to v30.7.0 to fix has_bit_strings error.
* Adapt test suite to pygments 2.20.0


1.72.0 (2026/05/08)
Expand Down
10 changes: 5 additions & 5 deletions test/pytests/test_naive_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from prompt_toolkit.document import Document
import pytest

from test.utils import pygments_at_least
from test.utils import pygments_below


@pytest.fixture
Expand Down Expand Up @@ -43,6 +43,7 @@ def test_function_name_completion(completer, complete_event):
'MAKEDATE',
'MAKETIME',
'MAKE_SET',
'MANUAL',
'MASTER',
'MASTER_AUTO_POSITION',
'MASTER_BIND',
Expand Down Expand Up @@ -82,10 +83,9 @@ def test_function_name_completion(completer, complete_event):
'MAX_USER_CONNECTIONS',
]

if pygments_at_least("2.20"):
expected.extend([
'MANUAL',
])
if pygments_below("2.20"):
expected.remove('MANUAL')

assert sorted(x.text for x in result) == sorted(expected)


Expand Down
35 changes: 24 additions & 11 deletions test/pytests/test_smart_completion_public_schema_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest

import mycli.packages.special.main as special
from test.utils import pygments_at_least
from test.utils import pygments_below

metadata = {
"users": ["id", "email", "first_name", "last_name"],
Expand Down Expand Up @@ -862,6 +862,7 @@ def test_backticked_column_completion_two_character(completer, complete_event):
Completion(text='`fixed`', start_position=-2),
Completion(text='`float`', start_position=-2),
Completion(text='`fetch`', start_position=-2),
Completion(text='`files`', start_position=-2),
Completion(text='`first`', start_position=-2),
Completion(text='`flush`', start_position=-2),
Completion(text='`force`', start_position=-2),
Expand All @@ -879,14 +880,19 @@ def test_backticked_column_completion_two_character(completer, complete_event):
Completion(text='`fulltext`', start_position=-2),
Completion(text='`function`', start_position=-2),
Completion(text='`from_days`', start_position=-2),
Completion(text='`file_name`', start_position=-2),
Completion(text='`following`', start_position=-2),
Completion(text='`first_name`', start_position=-2),
Completion(text='`found_rows`', start_position=-2),
Completion(text='`find_in_set`', start_position=-2),
Completion(text='`first_value`', start_position=-2),
Completion(text='`from_base64`', start_position=-2),
Completion(text='`from_vector`', start_position=-2),
Completion(text='`file_format`', start_position=-2),
Completion(text='`file_prefix`', start_position=-2),
Completion(text='`foreign key`', start_position=-2),
Completion(text='`format_bytes`', start_position=-2),
Completion(text='`file_pattern`', start_position=-2),
Completion(text='`from_unixtime`', start_position=-2),
Completion(text='`file_block_size`', start_position=-2),
Completion(text='`format_pico_time`', start_position=-2),
Expand All @@ -913,17 +919,18 @@ def test_backticked_column_completion_two_character(completer, complete_event):
Completion(text='`references`', start_position=-2),
]

if pygments_at_least("2.20"):
expected.extend([
if pygments_below("2.20"):
for newer in [
Completion(text='`file_format`', start_position=-2),
Completion(text='`file_name`', start_position=-2),
Completion(text='`file_pattern`', start_position=-2),
Completion(text='`file_prefix`', start_position=-2),
Completion(text='`files`', start_position=-2),
Completion(text='`from_vector`', start_position=-2),
])
]:
expected.remove(newer)

assert sorted((x.text, x.start_position) for x in result) == sorted((x.text, x.start_position) for x in expected)
assert result == expected


def test_backticked_column_completion_three_character(completer, complete_event):
Expand All @@ -935,13 +942,18 @@ def test_backticked_column_completion_three_character(completer, complete_event)
Completion(text='`file`', start_position=-3),
Completion(text='`field`', start_position=-3),
Completion(text='`fixed`', start_position=-3),
Completion(text='`files`', start_position=-3),
Completion(text='`first`', start_position=-3),
Completion(text='`fields`', start_position=-3),
Completion(text='`filter`', start_position=-3),
Completion(text='`finish`', start_position=-3),
Completion(text='`file_name`', start_position=-3),
Completion(text='`first_name`', start_position=-3),
Completion(text='`find_in_set`', start_position=-3),
Completion(text='`first_value`', start_position=-3),
Completion(text='`file_format`', start_position=-3),
Completion(text='`file_prefix`', start_position=-3),
Completion(text='`file_pattern`', start_position=-3),
Completion(text='`file_block_size`', start_position=-3),
Completion(text='`definer`', start_position=-3),
Completion(text='`definition`', start_position=-3),
Expand All @@ -955,16 +967,17 @@ def test_backticked_column_completion_three_character(completer, complete_event)
Completion(text='`foreign key`', start_position=-3),
]

if pygments_at_least("2.20"):
expected.extend([
Completion(text='`file_format`', start_position=-3),
if pygments_below("2.20"):
for newer in [
Completion(text='`files`', start_position=-3),
Completion(text='`file_name`', start_position=-3),
Completion(text='`file_format`', start_position=-3),
Completion(text='`file_pattern`', start_position=-3),
Completion(text='`file_prefix`', start_position=-3),
Completion(text='`files`', start_position=-3),
])
]:
expected.remove(newer)

assert sorted((x.text, x.start_position) for x in result) == sorted((x.text, x.start_position) for x in expected)
assert result == expected


def test_backticked_column_completion_four_character(completer, complete_event):
Expand Down
4 changes: 2 additions & 2 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
PYGMENTS_VERSION = Version(pygments.__version__)


def pygments_at_least(version: str) -> bool:
return PYGMENTS_VERSION >= Version(version)
def pygments_below(version: str) -> bool:
return PYGMENTS_VERSION < Version(version)


class DummyLogger:
Expand Down
Loading