MCPcopy Index your code
hub / github.com/codespell-project/codespell / test_ignore_dictionary

Function test_ignore_dictionary

codespell_lib/tests/test_basic.py:352–387  ·  view source on GitHub ↗

Test ignore dictionary functionality.

(
    tmp_path: Path,
    capsys: pytest.CaptureFixture[str],
)

Source from the content-addressed store, hash-verified

350
351
352def test_ignore_dictionary(
353 tmp_path: Path,
354 capsys: pytest.CaptureFixture[str],
355) -> None:
356 """Test ignore dictionary functionality."""
357 bad_name = tmp_path / "bad.txt"
358 bad_name.write_text(
359 "1 abandonned 1\n"
360 "2 abandonned 2\n"
361 "3 abandonned 3\r\n"
362 "4 abilty 4\n"
363 "5 abilty 5\n"
364 "6 abilty 6\r\n"
365 "7 ackward 7\n"
366 "8 ackward 8\n"
367 "9 ackward 9\r\n"
368 "abondon\n"
369 )
370 assert cs.main(bad_name) == 10
371 fname = tmp_path / "ignore.txt"
372 fname.write_text("abandonned\nabilty\r\nackward")
373 assert cs.main("-I", fname, bad_name) == 1
374 # missing file in ignore list
375 fname_missing = tmp_path / "missing.txt"
376 result = cs.main("-I", fname_missing, bad_name, std=True)
377 assert isinstance(result, tuple)
378 code, _, stderr = result
379 assert code == EX_USAGE
380 assert "ERROR:" in stderr
381 # comma-separated list of files
382 fname_dummy1 = tmp_path / "dummy1.txt"
383 fname_dummy1.touch()
384 fname_dummy2 = tmp_path / "dummy2.txt"
385 fname_dummy2.touch()
386 assert cs.main("-I", fname_dummy1, "-I", fname, "-I", fname_dummy2, bad_name) == 1
387 assert cs.main("-I", f"{fname_dummy1},{fname},{fname_dummy2}", bad_name) == 1
388
389
390def test_ignore_words_with_cases(

Callers

nothing calls this directly

Calls 1

mainMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…