File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -304,7 +304,15 @@ Its advocates believe it produces better code faster because:
304304 rather than to find errors.
3053052 . Writing tests helps programmers figure out what the function is actually supposed to do.
306306
307- Here are three test functions for ` range_overlap ` :
307+ We start by defining an empty function ` range_overlap ` :
308+
309+ ~~~
310+ def range_overlap(ranges):
311+ pass
312+ ~~~
313+ {: .language-python}
314+
315+ Here are three test statements for ` range_overlap ` :
308316
309317~~~
310318assert range_overlap([ (0.0, 1.0) ]) == (0.0, 1.0)
@@ -326,10 +334,9 @@ AssertionError:
326334{: .error}
327335
328336The error is actually reassuring:
329- we haven't written ` range_overlap ` yet,
330- so if the tests passed,
331- it would be a sign that someone else had
332- and that we were accidentally using their function.
337+ we haven't implemented any logic into ` range_overlap ` yet,
338+ so if the tests passed, it would indicate that we've written
339+ an entirely ineffective test.
333340
334341And as a bonus of writing these tests,
335342we've implicitly defined what our input and output look like:
You can’t perform that action at this time.
0 commit comments