LinLihe / section-2-activity-1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test Driven Development (TDD) Practice

Assume section2.py has a function named square, which takes in a number, squares it (multiply by itself) and returns the result

Your goal is to:

  • Write a test case for such a function in a separate file: section2_test.py
  • Test if it works the way you expect it to, i.e. gives you a square of the number you passed as an argument
  • Think about
    • What number(s) you will test against
    • How many such cases you will test against?
  • Create section2.py and write the square function as shown on the screen
  • Run the test. Does it fail?
  • If it catches a bug in the code, fix it and run the tests again

About