diff --git a/contacts/cli.py b/contacts/cli.py index 2383c51..6e9da0a 100644 --- a/contacts/cli.py +++ b/contacts/cli.py @@ -9,7 +9,7 @@ from rich.progress import Progress from rich.table import Table -from contacts import contact, keyword +from contacts import contact, query from contacts.address_book import AddressBook from contacts.applescript_address_book import AppleScriptBasedAddressBook from contacts.category import Category @@ -107,7 +107,7 @@ def main( console = Console(width=width, safe_box=safe_box) with Progress(transient=True, console=console) as progress: task = progress.add_task("Counting contacts") - keywords = keyword.prepare_keywords(keywords or []) + keywords = query.prepare_keywords(keywords or []) address_book = get_address_book( brief=not (detail or json or check or fix), diff --git a/contacts/keyword.py b/contacts/query.py similarity index 98% rename from contacts/keyword.py rename to contacts/query.py index d74d65e..f815679 100644 --- a/contacts/keyword.py +++ b/contacts/query.py @@ -1,4 +1,4 @@ -"""Keyword operations.""" +"""Query operations.""" from functools import cache from itertools import chain, combinations diff --git a/tests/test_keyword.py b/tests/test_query.py similarity index 56% rename from tests/test_keyword.py rename to tests/test_query.py index 953a9ae..d468441 100644 --- a/tests/test_keyword.py +++ b/tests/test_query.py @@ -1,11 +1,11 @@ -"""Unittests for keyword.""" +"""Unittests for query.""" import importlib import pytest from typer.testing import CliRunner -from contacts import config, keyword +from contacts import config, query runner = CliRunner(mix_stderr=True) @@ -15,25 +15,25 @@ def cfg(monkeypatch: pytest.MonkeyPatch) -> config.Config: """Initialize the test configuration.""" cfg = config.Config() monkeypatch.setattr(config, "get_config", lambda: cfg) - importlib.reload(keyword) + importlib.reload(query) return cfg def test_prepare() -> None: """Test non-extended prepare.""" - assert keyword.prepare_keywords(["amelia", "bob"]) == ["Amelia", "Bob"] - assert keyword.prepare_keywords(["bob", "amelia"]) == ["Amelia", "Bob"] - assert keyword.prepare_keywords(["carnival balloon"]) == ["Carnival Balloon"] + assert query.prepare_keywords(["amelia", "bob"]) == ["Amelia", "Bob"] + assert query.prepare_keywords(["bob", "amelia"]) == ["Amelia", "Bob"] + assert query.prepare_keywords(["carnival balloon"]) == ["Carnival Balloon"] def test_prepare_romanize(cfg: config.Config) -> None: """Test non-extended prepare.""" cfg.romanize = "öøÑ" - assert keyword.romanization() == {"n": ["ñ"], "o": ["ö", "ø"]} - assert set(keyword.prepare_keywords(["BOB"])) == {"Bob", "Böb", "Bøb"} - assert set(keyword.prepare_keywords(["BoB"])) == {"Bob", "Böb", "Bøb"} - assert set(keyword.prepare_keywords(["bob"])) == {"Bob", "Böb", "Bøb"} - assert set(keyword.prepare_keywords(["balloon"])) == { + assert query.romanization() == {"n": ["ñ"], "o": ["ö", "ø"]} + assert set(query.prepare_keywords(["BOB"])) == {"Bob", "Böb", "Bøb"} + assert set(query.prepare_keywords(["BoB"])) == {"Bob", "Böb", "Bøb"} + assert set(query.prepare_keywords(["bob"])) == {"Bob", "Böb", "Bøb"} + assert set(query.prepare_keywords(["balloon"])) == { "Balloon", "Ballooñ", "Balloön",