Skip to content

Commit

Permalink
change exception for unknown divisions len call
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis committed Jan 24, 2024
1 parent 3457139 commit 4639ff5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dask_awkward/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_io_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4639ff5

Please sign in to comment.