Skip to content

Commit 36ae543

Browse files
committed
Add doctest for iter function
1 parent 65719fd commit 36ae543

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

data_structures/arrays/index_2d_array_in_1d.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,18 @@ class Index2DArrayIterator:
2828
and all columns are the same size.
2929
"""
3030

31-
def __init__(self, array: list[list[int]]):
31+
def __init__(self, array: list[list[int]]) -> None:
3232
self.array = array
3333
self.cols = len(array[0])
3434
self.n = len(array) * len(array[0])
3535
self.i = 0
3636

3737
def __iter__(self) -> Iterator[int]:
38+
"""
39+
>>> t = Index2DArrayIterator([[5],[-523],[-1],[34],[0]])
40+
>>> t.__iter__() is not None
41+
True
42+
"""
3843
return self
3944

4045
def __next__(self) -> int:

0 commit comments

Comments
 (0)