diff options
author | Christopher Burns | 2010-06-29 00:59:26 -0500 |
---|---|---|
committer | Christopher Burns | 2010-06-29 00:59:26 -0500 |
commit | 08c1e21f429674f0b887552a4ad86acd36402fe4 (patch) | |
tree | ff3fac0d4a39d3591e23d119869a1c7cd128c616 | |
parent | 22e1ca7385237831eb3e371070b377fe6e467ac2 (diff) | |
download | workshops-more-scipy-08c1e21f429674f0b887552a4ad86acd36402fe4.tar.gz workshops-more-scipy-08c1e21f429674f0b887552a4ad86acd36402fe4.tar.bz2 workshops-more-scipy-08c1e21f429674f0b887552a4ad86acd36402fe4.zip |
DOC: Add more slides on testing
--HG--
branch : scipy2010
-rw-r--r-- | day2/session4.tex | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/day2/session4.tex b/day2/session4.tex index b983e9f..bf3c70f 100644 --- a/day2/session4.tex +++ b/day2/session4.tex @@ -202,6 +202,23 @@ Edit \texttt{gcd.py} file to: \end{itemize} \end{frame} + +\begin{frame}[fragile] + \frametitle{Automating tests} + \begin{lstlisting} + +def gcd(a, b): + if a % b == 0: + return b + return gcd(b, a % b) + +if __name__ == '__main__': + assert gcd(15, 65) == 5 + assert gcd(16, 76) == 4 + + \end{lstlisting} +\end{frame} + \begin{frame}[fragile] \frametitle{Automating tests} \begin{lstlisting} @@ -217,6 +234,18 @@ if __name__ == '__main__': \end{lstlisting} \end{frame} +\begin{frame}[fragile] + \frametitle{Python Test Packages} + \begin{itemize} + +\item Python's \typ{unittest}:\linebreak + \url{http://docs.python.org/library/unittest.html} +\linebreak +\item \typ{nose}:\linebreak + \url{http://code.google.com/p/python-nose/} + \end{itemize} +\end{frame} + \section{Coding Style} \begin{frame}{Readability and Consistency} \begin{itemize} |