Skip to content

Commit 9de1b69

Browse files
Create introduction for Python-TDD tutorial
Added an introduction to the Python-TDD tutorial, explaining TDD and its steps, along with the module structure.
1 parent feb2e01 commit 9de1b69

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

docs/introduction.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Hello Python, Hi TDD!
2+
========================
3+
4+
Introduction
5+
+++++++++++++
6+
Hi and welcome to the Python-TDD tutorial where we are gonna learn **Python**
7+
by **TDD**. It's more advanced **Python** which means that you must
8+
have basic experience with this language.
9+
10+
So here you will learn and practice how to write custom *decorator*,
11+
*iterator*, *context manager* etc. Hope that you will enjoy it.
12+
13+
14+
What is TDD?
15+
++++++++++++++
16+
`TDD (Test Driven Development) <https://en.wikipedia.org/wiki/Test-driven_development/>`_
17+
- is a software development process that relies on the repetition of a very short
18+
development cycle: requirements are turned into very specific test cases, then the
19+
software is improved to pass the new tests, only.
20+
21+
.. figure:: _static/images/tdd.png
22+
:align: center
23+
24+
TDD.
25+
26+
How to start for TDD
27+
---------------------
28+
Here are the four steps required to do the TDD which one should remember by heart
29+
30+
1. Write “enough” failing tests before writing the production code
31+
2. Write production code to pass those failing tests
32+
3. Re-factor the code, if required.
33+
4. GoTo Step — 1
34+
35+
You are lucky
36+
---------------------
37+
Fortunately for you we have written tests for your tasks. So you will start your cycle
38+
from the *second* step. **[step-2, step-3, step-4]** *<next>* **[2, 3, 4]** *<next>*
39+
**[2, 3, 4]** ...
40+
41+
42+
Module structure
43+
++++++++++++++++++
44+
Every module have the next structure:
45+
::
46+
47+
| module
48+
| ├── answers (our implementation)
49+
| │ └── program.py
50+
| ├── tests (tests)
51+
| │ ├── test_program.py
52+
| ├── program.py (your implementation)
53+
| ├── instruction.md (what to do and how to run test)
54+
55+
56+
57+
+---------------+--------------+--------------------------------------------------------------------------+
58+
| Folder/File | Example | Description |
59+
+===============+==============+==========================================================================+
60+
| ***.py** | *program.py* | All ***.py** files in the root directory you have to implement. |
61+
| | | |
62+
+---------------+--------------+--------------------------------------------------------------------------+
63+
| **tests/*** | *test_\*\.py*| Tests you have to run without failures. |
64+
| | | |
65+
+---------------+--------------+--------------------------------------------------------------------------+
66+
| **answers/*** | *program.py* | Our implementation you can compare with your |
67+
| | | |
68+
+---------------+--------------+--------------------------------------------------------------------------+

0 commit comments

Comments
 (0)