Skip to content

Fix sphinx/build_docs warnings for maths/zellers_congruence #12481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions maths/zellers_congruence.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

def zeller(date_input: str) -> str:
"""
Zellers Congruence Algorithm
Find the day of the week for nearly any Gregorian or Julian calendar date
| Zellers Congruence Algorithm
| Find the day of the week for nearly any Gregorian or Julian calendar date

>>> zeller('01-31-2010')
'Your date 01-31-2010, is a Sunday!'

Validate out of range month
Validate out of range month:

>>> zeller('13-31-2010')
Traceback (most recent call last):
...
Expand All @@ -21,6 +22,7 @@ def zeller(date_input: str) -> str:
ValueError: invalid literal for int() with base 10: '.2'

Validate out of range date:

>>> zeller('01-33-2010')
Traceback (most recent call last):
...
Expand All @@ -31,30 +33,35 @@ def zeller(date_input: str) -> str:
ValueError: invalid literal for int() with base 10: '.4'

Validate second separator:

>>> zeller('01-31*2010')
Traceback (most recent call last):
...
ValueError: Date separator must be '-' or '/'

Validate first separator:

>>> zeller('01^31-2010')
Traceback (most recent call last):
...
ValueError: Date separator must be '-' or '/'

Validate out of range year:

>>> zeller('01-31-8999')
Traceback (most recent call last):
...
ValueError: Year out of range. There has to be some sort of limit...right?

Test null input:

>>> zeller()
Traceback (most recent call last):
...
TypeError: zeller() missing 1 required positional argument: 'date_input'

Test length of date_input:
Test length of `date_input`:

>>> zeller('')
Traceback (most recent call last):
...
Expand Down
Loading