O'Reilly logo

Python Testing Beginner's Guide by Daniel Arbuckle

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - unit testing during feedback

So, how are we going to deal with this? The program passes all the tests, but the tests no longer reflect the requirements.

  1. Add the initial parameter to the constructor test, and update the expected results.
  2. Add a second constructor test, which tests the optional time parameter that is now expected to be part of the constructor.
  3. Change the measure method's name to calculate_response in all tests.
  4. Add the initial constructor parameter in the calculate_response test - while we're doing that, we notice that this is going to change the way the calculate_response function behaves. We contact the client for clarification, and they decide it's okay, so we update the expectations to match what we calculate should ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required