diff --git a/src/dask_awkward/lib/core.py b/src/dask_awkward/lib/core.py index 2585661e1..f41cda083 100644 --- a/src/dask_awkward/lib/core.py +++ b/src/dask_awkward/lib/core.py @@ -975,7 +975,7 @@ def repartition( def __len__(self) -> int: if not self.known_divisions: - raise NotImplementedError( + raise TypeError( "Cannot determine length of collection with unknown partition sizes without executing the graph.\n" "Use `dask_awkward.num(..., axis=0)` if you want a lazy Scalar of the length.\n" "If you want to eagerly compute the partition sizes to have the ability to call `len` on the collection" diff --git a/tests/test_core.py b/tests/test_core.py index 5d9c9a4e6..0c5f8adfe 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -104,7 +104,7 @@ def test_len(ndjson_points_file: str) -> None: daa = dak.from_json([ndjson_points_file] * 2) assert not daa.known_divisions with pytest.raises( - NotImplementedError, + TypeError, match=( "Cannot determine length of collection with unknown partition sizes without executing the graph.\\n" "Use `dask_awkward.num\\(\\.\\.\\., axis=0\\)` if you want a lazy Scalar of the length.\\n" diff --git a/tests/test_io_json.py b/tests/test_io_json.py index 4837602ee..71f835bb1 100644 --- a/tests/test_io_json.py +++ b/tests/test_io_json.py @@ -60,7 +60,7 @@ def test_json_sanity(json_data_dir: Path, concrete_data: ak.Array) -> None: ds = dak.from_json(source) assert not ds.known_divisions with pytest.raises( - NotImplementedError, + TypeError, match=( "Cannot determine length of collection with unknown partition sizes without executing the graph.\\n" "Use `dask_awkward.num\\(\\.\\.\\., axis=0\\)` if you want a lazy Scalar of the length.\\n"