-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding hands, poker ranks, basic hand comparison, and writing more tests
- Loading branch information
1 parent
8262e6c
commit fd3ce29
Showing
8 changed files
with
318 additions
and
11 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
custom exceptions and error handling | ||
""" | ||
|
||
|
||
class GambleException(Exception): # pragma: no cover | ||
"""base gamble exception class""" | ||
|
||
def __init__(self, *args, **kwargs): # type: ignore | ||
"""exception constructor""" | ||
self.__dict__.update(kwargs) | ||
extra = "" | ||
if args: | ||
extra = '\n| extra info: "{extra}"'.format(extra=args[0]) | ||
print( | ||
"[{exception}]: {doc}{extra}".format( | ||
exception=self.__class__.__name__, doc=self.__doc__, extra=extra | ||
) | ||
) | ||
Exception.__init__(self, *args) | ||
|
||
|
||
class InvalidCard(GambleException): | ||
"""the given string is not a valid card""" |
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
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
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
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
Oops, something went wrong.