test: echte Reden liegen lokal in testdaten/<rede>/ mit ihrem Glossar
testdaten/ enthält je Rede einen Ordner mit .vtt, .txt und dem Glossar der Rede, keine Ausgaben mehr; gemeinsame Glossare bleiben in glossare/. Die lokalen Rede-Tests lesen von dort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ebaec63963
commit
775560a64c
2 changed files with 10 additions and 8 deletions
|
|
@ -14,7 +14,8 @@ REPO = Path(__file__).resolve().parent.parent
|
||||||
# Own, made-up sample speech; real speeches are only kept locally in testdaten/
|
# Own, made-up sample speech; real speeches are only kept locally in testdaten/
|
||||||
SAMPLE = REPO / "tests" / "daten" / "beispiel.de.txt"
|
SAMPLE = REPO / "tests" / "daten" / "beispiel.de.txt"
|
||||||
GLOSSARY = REPO / "tests" / "daten" / "beispiel.glossar.txt"
|
GLOSSARY = REPO / "tests" / "daten" / "beispiel.glossar.txt"
|
||||||
# Real glossaries and speeches are only kept locally (see .gitignore)
|
# Real glossaries and speeches are only kept locally (see .gitignore): shared
|
||||||
|
# glossaries in glossare/, each speech with its glossary in testdaten/<rede>/
|
||||||
GLOSSARIES = REPO / "glossare"
|
GLOSSARIES = REPO / "glossare"
|
||||||
SHARED_GLOSSARY = GLOSSARIES / "krone-schmalz.glossar.txt"
|
SHARED_GLOSSARY = GLOSSARIES / "krone-schmalz.glossar.txt"
|
||||||
SPEECHES = REPO / "testdaten"
|
SPEECHES = REPO / "testdaten"
|
||||||
|
|
@ -127,17 +128,18 @@ def test_build_system_appends_terms():
|
||||||
assert "keep only the surname" in ak.SYSTEM_EN
|
assert "keep only the surname" in ak.SYSTEM_EN
|
||||||
|
|
||||||
|
|
||||||
|
# testdaten/<rede>/: raw text and the glossary of that speech
|
||||||
SAMPLE_GLOSSARIES = [
|
SAMPLE_GLOSSARIES = [
|
||||||
("ramstein.glossar.txt", "ramstein.de.txt"),
|
("ramstein/ramstein.glossar.txt", "ramstein/ramstein.de.txt"),
|
||||||
("magdeburg.glossar.txt", "magdeburg.de-orig.txt"),
|
("magdeburg/magdeburg.glossar.txt", "magdeburg/magdeburg.de-orig.txt"),
|
||||||
("lahnstein.glossar.txt", "Lahnstein.de-orig.txt"),
|
("lahnstein/lahnstein.glossar.txt", "lahnstein/Lahnstein.de-orig.txt"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Real speeches and their glossaries are not in the repository; without them these skip
|
# Real speeches and their glossaries are not in the repository; without them these skip
|
||||||
needs_speeches = pytest.mark.skipif(
|
needs_speeches = pytest.mark.skipif(
|
||||||
not all(
|
not all(
|
||||||
(SPEECHES / sample).is_file() and (GLOSSARIES / glossary).is_file()
|
(SPEECHES / sample).is_file() and (SPEECHES / glossary).is_file()
|
||||||
for glossary, sample in SAMPLE_GLOSSARIES
|
for glossary, sample in SAMPLE_GLOSSARIES
|
||||||
) or not SHARED_GLOSSARY.is_file(),
|
) or not SHARED_GLOSSARY.is_file(),
|
||||||
reason="echte Reden (testdaten/) und ihre Glossare nur lokal",
|
reason="echte Reden (testdaten/) und ihre Glossare nur lokal",
|
||||||
|
|
@ -157,7 +159,7 @@ def test_sample_glossary_replacements_all_match(capsys, glossary, sample):
|
||||||
text = flat((SPEECHES / sample).read_text(encoding="utf-8"))
|
text = flat((SPEECHES / sample).read_text(encoding="utf-8"))
|
||||||
text = ak.apply_replacements(text, ak.read_glossary(SHARED_GLOSSARY)[1])
|
text = ak.apply_replacements(text, ak.read_glossary(SHARED_GLOSSARY)[1])
|
||||||
capsys.readouterr()
|
capsys.readouterr()
|
||||||
ak.apply_replacements(text, ak.read_glossary(GLOSSARIES / glossary)[1])
|
ak.apply_replacements(text, ak.read_glossary(SPEECHES / glossary)[1])
|
||||||
assert "ohne Treffer" not in capsys.readouterr().out
|
assert "ohne Treffer" not in capsys.readouterr().out
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,8 @@ def speech(name):
|
||||||
|
|
||||||
@pytest.mark.parametrize("vtt_path", [
|
@pytest.mark.parametrize("vtt_path", [
|
||||||
SAMPLE_VTT,
|
SAMPLE_VTT,
|
||||||
speech("ramstein.de.vtt"), speech("magdeburg.de-orig.vtt"),
|
speech("ramstein/ramstein.de.vtt"), speech("magdeburg/magdeburg.de-orig.vtt"),
|
||||||
speech("Lahnstein.de-orig.vtt"),
|
speech("lahnstein/Lahnstein.de-orig.vtt"),
|
||||||
])
|
])
|
||||||
def test_sample_vtt_gives_sample_txt(vtt_path):
|
def test_sample_vtt_gives_sample_txt(vtt_path):
|
||||||
vtt = vtt_path.read_text(encoding="utf-8-sig")
|
vtt = vtt_path.read_text(encoding="utf-8-sig")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue