booleans: truth table¶
Sometimes I want programs to make decisions based on inputs or conditions, and can make this happen with if statements.
These are exercises on writing conditional expressions in Python using the Truth Table from Mathematics
requirements¶
I open a terminal to run makePythonTdd.sh with
truth_table
as the name of the project./makePythonTdd.sh truth_table
on Windows without Windows Subsystem Linux use makePythonTdd.ps1
./makePythonTdd.ps1 truth_table
it makes the folders and files that are needed, installs packages, runs the first test, and the terminal shows AssertionError
E AssertionError: True is not false tests/test_truth_table.py:7: AssertionError
I hold
ctrl
(windows/linux) oroption
(mac) on the keyboard and use the mouse to click ontests/test_truth_table.py:7
to open it in the editorthen change
True
toFalse
to make the test passI add an import statement
import unittest import src.truth_table
Operations¶
how to run automated tests if you exit¶
cd truth_table
source .venv/bin/activate
pytest-watch
how to run automated tests on Windows without WSL if you exit¶
Warning
This is for Windows without Windows Subsystem Linux
cd truth_table
.venv/scripts/activate.ps1
pytest-watch