Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Consiliency_treesitter-chunker /tests /test_codechunk_ids_backcompat.py
| # Import DatabaseExporterBase without triggering package-level heavy imports | |
| import importlib | |
| from chunker.types import CodeChunk | |
| DatabaseExporterBase = importlib.import_module( | |
| "chunker.export.database_exporter_base", | |
| ).DatabaseExporterBase | |
| def test_chunk_id_aliases_node_id_and_exporter_prefers_node_id(): | |
| c = CodeChunk( | |
| language="python", | |
| file_path="/tmp/x.py", | |
| node_type="function_definition", | |
| start_line=1, | |
| end_line=3, | |
| byte_start=0, | |
| byte_end=10, | |
| parent_context="module", | |
| content="def f():\n pass\n", | |
| ) | |
| # Standard behavior: both chunk_id and node_id are 40-char SHA-1 | |
| assert len(c.chunk_id) == 40 | |
| assert len(c.node_id) == 40 | |
| assert c.chunk_id == c.node_id | |
| # Exporter should use chunk_id (40-char) | |
| assert DatabaseExporterBase._get_chunk_id(c) == c.chunk_id | |
Xet Storage Details
- Size:
- 875 Bytes
- Xet hash:
- 3e8ecba06593e039e58427cc81fb7c240effbce98e464097a7fc38f33a2abead
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.