reading-notes

My reading notes journal for Code Fellows

View the Project on GitHub

Readings: Testing and Modules

In Tests We Trust - TDD with Python

Unit tests are used to test our code and should be used each time you complete a section of code. This insures functionality and further errors down the road.

TDD is also important because you can really battle test your site for any possibility that can arise that would be a major issue once completely deployed a majority of web sites would be in disarray if Unit tests and TDD wasn’t done.

The cycle is made by three steps:

Write a unit test and make it fail (it needs to fail because the feature isn’t there, right?

Write the feature and make the test pass!

Refactor the code — the first version doesn’t need to be the beautiful one

Cited from: https://code.likeagirl.io/in-tests-we-trust-tdd-with-python-af69f47e6932

If name equals main

If the python interpreter is running that module (the source file) as the main program, it sets the special name variable to have a value “main”.

If this file is being imported from another module, name will be set to the module’s name. Module’s name is available as value to name global variable.

A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended.

Recursion

Recursion is when a function calls on itself directly/indirectly This in-turn becomes a recursion function You can use this to handle small problems within the main problem. https://www.youtube.com/watch?v=Mv9NEXX1VHc

What on Earth is Recursion

REFERENCES

https://www.geeksforgeeks.org/introduction-to-recursion-data-structure-and-algorithm-tutorials/

https://www.geeksforgeeks.org/what-does-the-if-__name__-__main__-do/