Files
chemenu/tools/chemenu/tests/test_util.py
T
torben 18ae28f918
CI / verify (push) Failing after 32s
Release / release (push) Successful in 38s
Chemenu 2.1.0 - deterministischer Wissenskompiler
Chemenu kompiliert Rohnotizen zu einem verlinkten, quellengebundenen Wiki:
raw/ -> types/ + tools/ -> kb/ -> reports/. Was mechanisch ist, macht
tools/wikitool; was Urteil braucht, macht ein Agent unter Contracts, deren
Grenzen in Code durchgesetzt sind statt im Prompt.

Dieser Commit ist der Startpunkt der oeffentlichen Historie. Die vorherige
Entwicklung fand in einer privaten Instanz statt und ist nicht Teil dieses
Repositorys; ihre Erzaehlung steht vollstaendig in CHANGES.md, das mit 44
Eintraegen von 0.1.0 bis 2.1.0 erhalten geblieben ist.

Der mitgelieferte Korpus ist ein Testbett und eine Demo: 170 Seiten ueber den
Stack selbst - Gates, Lint, Versionierung, Suche, das Wiki-Muster. Er
dokumentiert das Werkzeug mit den eigenen Mitteln des Werkzeugs.

Lizenz: AGPL-3.0 fuer den Stack (tools/, types/), CC-BY-4.0 fuer die Inhalte.
Die Grenze zwischen beiden ist der Dateiplan, den dist export berechnet -
siehe NOTICE.
2026-09-01 16:26:14 +02:00

30 lines
1.0 KiB
Python

"""Shared CLI helpers - the list format `--set` and the xref flags both use."""
from chemenu.commands._util import parse_list
def test_parse_list_splits_on_commas_and_trims():
assert parse_list("a, b ,c") == ["a", "b", "c"]
assert parse_list("") == []
assert parse_list(None) == []
assert parse_list(" , ,") == []
def test_escaped_comma_stays_inside_the_element():
"""Without an escape a list format cannot express an element containing a
comma, and shell quoting is no help - the quotes are gone before this sees
the string. It once cost a raw/ file its original filename."""
value = r"raw/notes/Versioning\, CI-CD and Content Migration.md"
assert parse_list(value) == ["raw/notes/Versioning, CI-CD and Content Migration.md"]
def test_escaped_and_separating_commas_mix_in_one_value():
assert parse_list(r"Smith\, John,Doe\, Jane,plain") == [
"Smith, John",
"Doe, Jane",
"plain",
]
def test_escape_survives_surrounding_whitespace():
assert parse_list(r" A\, B , C ") == ["A, B", "C"]