Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 685 Bytes

README.md

File metadata and controls

28 lines (18 loc) · 685 Bytes

Days Left In Year

A small Python exercise for practising unit testing and CI/CD.

The code

DaysLeftInYear.py exposes one function:

days_left_in_year(today: date | None = None) -> int

It returns the number of days remaining in the year after today, defaulting to the current date. December 31st returns 0.

Running

python3 DaysLeftInYear.py     # print the days left today
python3 -m unittest -v        # run the test suite

Continuous integration

.github/workflows/tests.yml runs the test suite on every push and pull request, against Python 3.10, 3.11 and 3.12.

Requires Python 3.10 or newer (the date | None type hint syntax).