-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5783164
commit 8883eb2
Showing
2 changed files
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
|
||
class PositiveIntegerError(Exception): | ||
"""Error raised when given a negative integer, but a positive integer was expected.""" | ||
|
||
def __init__(self, integer: int) -> None: | ||
super().__init__(f"Expected a positive integer, but got {integer}!") | ||
self.integer = integer | ||
|
||
|
||
class StrictlyPositiveIntegerError(Exception): | ||
"""Error raised when given a negative integer, but a strictly positive integer was expected.""" | ||
|
||
def __init__(self, integer: int) -> None: | ||
super().__init__(f"Expected a strictly positive integer, but got {integer}!") | ||
self.integer = integer | ||
|
||
|
||
class InfiniteSequenceError(Exception): | ||
"""Error raised when asking for finite sequence property to an infinite sequence.""" | ||
|
||
def __init__(self, sequence_name: str) -> None: | ||
super().__init__(f"The length function is not implemented for {sequence_name}, as the sequence is infinite!") | ||
self.sequence_name = sequence_name | ||
|
||
|
||
class NotPeriodicSequenceError(Exception): | ||
"""Error raised when asking period to a non-periodic sequence.""" | ||
|
||
def __init__(self, sequence_name: str) -> None: | ||
super().__init__(f"The {sequence_name} is not periodic!") | ||
self.sequence_name = sequence_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters