Skip to content

Commit 1c99a4b

Browse files
committed
improve exceptions and remove wip code to test the excpetion
1 parent 073f4c1 commit 1c99a4b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: lazy_dataset/core.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ def from_dataset(
214214
>>> from_dataset(ds)
215215
ListDataset(len=4)
216216
MapDataset(_pickle.loads)
217-
>>> list(ds.items())
218217
219218
"""
220219
try:
@@ -434,7 +433,10 @@ def copy(self, freeze: bool = False) -> 'Dataset':
434433
Returns:
435434
A copy of this dataset
436435
"""
437-
raise NotImplementedError
436+
raise NotImplementedError(
437+
f'copy is not implemented for {self.__class__}.\n'
438+
f'self: \n{repr(self)}'
439+
)
438440

439441
def __iter__(self, with_key=False):
440442
if with_key:
@@ -2706,8 +2708,8 @@ def __iter__(self, with_key=False):
27062708
if with_key:
27072709
try:
27082710
self.keys()
2709-
except AssertionError:
2710-
raise _ItemsNotDefined(self.__class__.__name__) from None
2711+
except AssertionError as e:
2712+
raise _ItemsNotDefined(self.__class__.__name__) from e
27112713

27122714
for input_dataset in self.input_datasets:
27132715
if with_key:
@@ -2996,6 +2998,7 @@ def __init__(self, *input_datasets):
29962998
]
29972999
raise AssertionError(
29983000
f'Expect that all input_datasets have the same keys. '
3001+
f'Missing: {lengths} of {len(keys)}\n'
29993002
f'Missing keys: '
30003003
f'{missing_keys}\n{self.input_datasets}'
30013004
)

0 commit comments

Comments
 (0)