democritus-project / d8s-dates

Democritus functions for working with dates and times.
GNU Lesser General Public License v3.0
0 stars 2 forks source link

Add tests to test edge-cases for the "time_as_float" function #10

Open fhightower opened 3 years ago

fhightower commented 3 years ago

HELP WANTED 👋 : If you'd like to take this challenge on, please let me know! Even if you're new to Python and/or github, this is a great place to start and I'd be happy to help walk you through this challenge as much as you need - don't hesitate to ask.

This particular issue will give you some exposure to using pytest to test functions (specifically to test error handling in a function).


We recently added the time_as_float function (#8) which is used like:

time_as_float("12:30")  # 12.5

As you can see in the function's code, the function does a nice job of raising an error if it gets bad input (like "abc" or "a:b").

We should write tests to make sure that errors are raised when bad input is given. So, the goal of this issue is to write tests that:

  1. Give bad input into the time_as_float function
  2. Validate that the appropriate exception is raised (hint: pytest has a good way of doing this documented here)

If you are interested in working on this issue, but need some more guidance on where/how to start, please comment on this issue and I'll be happy to help!