From 08c1e21f429674f0b887552a4ad86acd36402fe4 Mon Sep 17 00:00:00 2001 From: Christopher Burns Date: Tue, 29 Jun 2010 00:59:26 -0500 Subject: DOC: Add more slides on testing --HG-- branch : scipy2010 --- day2/session4.tex | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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} -- cgit