Buckets:

download
raw
1 kB
from chunker.auto import ZeroConfigAPI
from chunker.exceptions import LanguageNotFoundError
class _InstalledRegistry:
def is_language_installed(self, _language):
return True
def test_auto_chunk_falls_back_for_grammar_load_failure(tmp_path, monkeypatch):
source = tmp_path / "example.py"
source.write_text("def example():\n return 1\n")
monkeypatch.setattr(
"chunker.auto.chunk_file",
lambda *_args, **_kwargs: (_ for _ in ()).throw(
LanguageNotFoundError("python", [])
),
)
result = ZeroConfigAPI(_InstalledRegistry()).auto_chunk_file(source)
assert result.fallback_used is True
assert result.chunks
def test_auto_chunk_replaces_invalid_utf8_in_fallback(tmp_path):
source = tmp_path / "notes.unknown"
source.write_bytes(b"valid\xff text\n")
result = ZeroConfigAPI(_InstalledRegistry()).auto_chunk_file(source)
assert result.fallback_used is True
assert "\ufffd" in result.chunks[0]["content"]

Xet Storage Details

Size:
1 kB
·
Xet hash:
e424d5d76f85a14bc0f769f6c887f0615e3687f5a5381f6bf5f2d1109ad1a6e7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.