@@ -22,6 +22,7 @@ We will write a function that computes this series -- then generalize it.
2222
2323.. _Fibonacci Series : http://en.wikipedia.org/wiki/Fibbonaci_Series
2424
25+
2526Step 1
2627------
2728
@@ -57,6 +58,7 @@ In your ``series.py`` module, add a new function ``lucas`` that returns the
5758
5859Ensure that your function has a well-formed ``docstring ``
5960
61+
6062Generalizing
6163------------
6264
@@ -75,8 +77,35 @@ parameters will produce other series.
7577
7678Ensure that your function has a well-formed ``docstring ``
7779
78- Tests...
79- --------
80+
81+ assert
82+ ------
83+
84+ Writing ``tests `` that demonstrate that your program works is an important part of learning to program.
85+
86+ The python ``assert `` statement is useful in writing simple tests
87+ for your code.
88+
89+ .. code-block :: ipython
90+
91+ In [1]: def add(n1, n2):
92+ ...: return n1 + n2
93+ ...:
94+
95+ In [2]: assert add(3, 4) == 7
96+
97+ In [3]: assert add(3, 4) == 10
98+
99+ ---------------------------------------------------------------------
100+ AssertionError Traceback (most recent call last)
101+ <ipython-input-3-6731d4ac4476> in <module>()
102+ ----> 1 assert add(3, 4) == 10
103+
104+ AssertionError:
105+
106+
107+ Tests
108+ -----
80109
81110Add a block of code to the end of your ``series.py ``
82111module. Use the block to write a series of ``assert `` statements that
@@ -91,3 +120,5 @@ your implementation. Include good commit messages that explain concisely both
91120When you are finished, push your changes to your fork of the class repository
92121in GitHub and make a pull request.
93122
123+
124+
0 commit comments