format check and lint resolved
This commit is contained in:
@@ -78,12 +78,14 @@ def _discover_schemes() -> dict[str, SchemeMeta]:
|
||||
|
||||
if modes:
|
||||
vname = var_dir.name.capitalize()
|
||||
variants.append(SchemeVariant(
|
||||
id=var_dir.name,
|
||||
name=vname,
|
||||
modes=frozenset(modes),
|
||||
accents=tuple(sorted(accents)),
|
||||
))
|
||||
variants.append(
|
||||
SchemeVariant(
|
||||
id=var_dir.name,
|
||||
name=vname,
|
||||
modes=frozenset(modes),
|
||||
accents=tuple(sorted(accents)),
|
||||
)
|
||||
)
|
||||
|
||||
schemes[sid] = SchemeMeta(
|
||||
id=sid,
|
||||
@@ -118,8 +120,7 @@ def get_palette(scheme: str, variant: str, mode: str, accent: str | None = None)
|
||||
if not txt_path.exists():
|
||||
var_info = next(v for v in meta.variants if v.id == variant)
|
||||
raise FileNotFoundError(
|
||||
f"No {mode} palette for '{scheme}:{variant}'. "
|
||||
f"Available modes: {sorted(var_info.modes)}"
|
||||
f"No {mode} palette for '{scheme}:{variant}'. Available modes: {sorted(var_info.modes)}"
|
||||
)
|
||||
|
||||
colors = _parse_txt(txt_path)
|
||||
|
||||
@@ -12,39 +12,23 @@ def tmp_schemes(tmp_path: Path) -> Path:
|
||||
|
||||
gmedium = schemes / "gruvbox" / "medium"
|
||||
gmedium.mkdir(parents=True)
|
||||
(gmedium / "dark.txt").write_text(
|
||||
"background 101415\nonBackground e0e3e4\nprimary 81d3e0\nsurface 1c2021\n"
|
||||
)
|
||||
(gmedium / "light.txt").write_text(
|
||||
"background fbf1c7\nonBackground 3c3836\nprimary 6b5f10\nsurface fbf1c7\n"
|
||||
)
|
||||
(gmedium / "dark.txt").write_text("background 101415\nonBackground e0e3e4\nprimary 81d3e0\nsurface 1c2021\n")
|
||||
(gmedium / "light.txt").write_text("background fbf1c7\nonBackground 3c3836\nprimary 6b5f10\nsurface fbf1c7\n")
|
||||
|
||||
ghard = schemes / "gruvbox" / "hard"
|
||||
ghard.mkdir(parents=True)
|
||||
(ghard / "dark.txt").write_text(
|
||||
"background 0b0d0e\nprimary 81d3e0\n"
|
||||
)
|
||||
(ghard / "dark.txt").write_text("background 0b0d0e\nprimary 81d3e0\n")
|
||||
|
||||
cmocha = schemes / "catppuccin" / "mocha"
|
||||
cmocha.mkdir(parents=True)
|
||||
(cmocha / "dark.txt").write_text(
|
||||
"background 1e1e2e\nprimary cba6f7\nsecondary 756294\nsurface 313244\n"
|
||||
)
|
||||
(cmocha / "mauve-dark.txt").write_text(
|
||||
"background 1e1e2e\nprimary cba6f7\nsecondary 756294\nsurface 313244\n"
|
||||
)
|
||||
(cmocha / "green-dark.txt").write_text(
|
||||
"background 1e1e2e\nprimary a6e3a1\nsecondary 5b8964\nsurface 313244\n"
|
||||
)
|
||||
(cmocha / "dark.txt").write_text("background 1e1e2e\nprimary cba6f7\nsecondary 756294\nsurface 313244\n")
|
||||
(cmocha / "mauve-dark.txt").write_text("background 1e1e2e\nprimary cba6f7\nsecondary 756294\nsurface 313244\n")
|
||||
(cmocha / "green-dark.txt").write_text("background 1e1e2e\nprimary a6e3a1\nsecondary 5b8964\nsurface 313244\n")
|
||||
|
||||
clatte = schemes / "catppuccin" / "latte"
|
||||
clatte.mkdir(parents=True)
|
||||
(clatte / "light.txt").write_text(
|
||||
"background eff1f5\nprimary 8839ef\nsecondary c2b8d0\nsurface ccd0da\n"
|
||||
)
|
||||
(clatte / "mauve-light.txt").write_text(
|
||||
"background eff1f5\nprimary 8839ef\nsecondary c2b8d0\nsurface ccd0da\n"
|
||||
)
|
||||
(clatte / "light.txt").write_text("background eff1f5\nprimary 8839ef\nsecondary c2b8d0\nsurface ccd0da\n")
|
||||
(clatte / "mauve-light.txt").write_text("background eff1f5\nprimary 8839ef\nsecondary c2b8d0\nsurface ccd0da\n")
|
||||
|
||||
cextra = schemes / "extra" / "default"
|
||||
cextra.mkdir(parents=True)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
from unittest.mock import patch, call
|
||||
from zshell.subcommands.shell import app
|
||||
|
||||
|
||||
def invoke(*args: str) -> None:
|
||||
from typer.testing import CliRunner
|
||||
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(app, args)
|
||||
if result.exit_code != 0:
|
||||
@@ -51,18 +51,14 @@ class TestLock:
|
||||
@patch("zshell.subcommands.shell.subprocess.run")
|
||||
def test_lock_runs_ipc_call_lock(self, mock_run):
|
||||
invoke("lock")
|
||||
mock_run.assert_called_once_with(
|
||||
["qs", "-c", "zshell", "ipc", "call", "lock", "lock"], check=True
|
||||
)
|
||||
mock_run.assert_called_once_with(["qs", "-c", "zshell", "ipc", "call", "lock", "lock"], check=True)
|
||||
|
||||
|
||||
class TestCall:
|
||||
@patch("zshell.subcommands.shell.subprocess.run")
|
||||
def test_call_no_args(self, mock_run):
|
||||
invoke("call", "target", "method")
|
||||
mock_run.assert_called_once_with(
|
||||
["qs", "-c", "zshell", "ipc", "call", "target", "method"], check=True
|
||||
)
|
||||
mock_run.assert_called_once_with(["qs", "-c", "zshell", "ipc", "call", "target", "method"], check=True)
|
||||
|
||||
@patch("zshell.subcommands.shell.subprocess.run")
|
||||
def test_call_with_args(self, mock_run):
|
||||
|
||||
Reference in New Issue
Block a user