booleans with assertRaises


preview

I have these tests by the end of the chapter


open the project


use assertRaises

RED: make it fail



GREEN: make it pass



REFACTOR: make it better



close the project

  • I close test_booleans.py

  • I click in the terminal where the tests are running

  • I use q on the keyboard to leave the tests. The terminal goes back to the command line.

  • I change directory to the parent of booleans

    cd ..
    

    the terminal shows

    .../pumping_python
    

    I am back in the pumping_python directory.


review

I know that bool is an object * bool_ only has two instances - False and True

In Python the following objects are grouped as

These things come in handy when I want programs to make decisions, because they can choose what to do based on if the data is grouped as False (0, empty or None ) or is grouped as True (positive and negative numbers or has something in it).

How many questions can you answer after going through this chapter?


code from the chapter

Do you want to see all the CODE I typed in this chapter?


what is next?

Would you like to test the truth table? It helps understand writing programs that make decisions based on conditions.


rate pumping python

If this has been a 7 star experience for you, please CLICK HERE to leave a 5 star review of pumping python. It helps other people get into the book too.