Skip to content

Commit 0f2bf9a

Browse files
authored
Update stack.py
1 parent 91498df commit 0f2bf9a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

data_structures/stacks/stack.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def pop(self):
4141
>>> Stack().pop()
4242
Traceback (most recent call last):
4343
...
44-
StackUnderflowError
44+
data_structures.stacks.stack.StackUnderflowError
4545
"""
4646
if not self.stack:
4747
raise StackUnderflowError
@@ -54,7 +54,7 @@ def peek(self):
5454
>>> Stack().pop()
5555
Traceback (most recent call last):
5656
...
57-
StackUnderflowError
57+
data_structures.stacks.stack.StackUnderflowError
5858
"""
5959
if not self.stack:
6060
raise StackUnderflowError
@@ -89,13 +89,13 @@ def test_stack() -> None:
8989
try:
9090
_ = stack.pop()
9191
assert False # This should not happen
92-
except IndexError:
92+
except StackUnderflowError:
9393
assert True # This should happen
9494

9595
try:
9696
_ = stack.peek()
9797
assert False # This should not happen
98-
except IndexError:
98+
except StackUnderflowError:
9999
assert True # This should happen
100100

101101
for i in range(10):

0 commit comments

Comments
 (0)