Unit Test... Nothing?
Did you know that a unit test doesn't even need to do anything to be useful? That's because it could catch runtime errors just by calling your function. Here's a function that sums the harmonic sequence, and you'll notice that it'll produce a division by zero error when the range of n begins with zero.
All we have to do is write a unit test that just calls the function, passes in a value, and does `assert True` on true. When you run it, it throws this error. Also, what are you doing writing unit tests? Get AI to write your unit tests!
Write a unit test for the Python function harmonic summation. Add to the existing test, and then just let it go. It'll find the right files, look at the file, figure out what it needs to do, and then add some appropriate tests for you.
Alright, it's given us three useful tests now that we didn't even have to write. I've uploaded this code to GitHub. There's a link to the GitHub account where you can find this code and check it out. See you later!
View the video