Construct the unit test folder in a way to mirror the working code - module for module. And be descriptive when naming test.
Then test it:
The three-step process to feature development:
Write the method for expected outcome.
Write the method for other expected scenerios.
The key principles are to test the code directly via cases, rather than chasing down bugs everywhere afterwards. The process is much faster.
This conditional in the code allows for more flexibility. It allows for either reusable modules or standalone programs. Meaning, you can specialize the use purpose without having to write another program.
Recursion works by a function calling a copy of itself under modified conditions. There needs to be a termination case (base case), and the function needs to work towards the either equily or less complex status of the original. Recusion uses a LIFO structure. When there is not enough space or the base case is not reach/not defined, a stack overflow will occur.
Modules are typically written in Python, while packages are a collection of modules. Packages can be created using the OS file system.
For importing modules, you just need to enter import <module_name>
at the top of your python file. For importing a specific object, from <module_name> import <name(s)>
. To import a specific module from a package, from pkg.mod3 import *
Functions can be assigned from pkg.sub_pkg2.mod4 import qux as grault
.
Otherwise, it can just be called using full notation pkg.sub_pkg1.mod1.foo()
.
How to structure the tests.