# HG changeset patch # User Christopher Burns # Date 1277791166 18000 # Node ID 13e5d0e2cd4019c359ccad1218a7a139c3b06b3c # Parent 9126059d6b37062cb9d6fa96e44a481ac75024aa DOC: Add more slides on testing diff -r 9126059d6b37 -r 13e5d0e2cd40 day2/session4.tex --- a/day2/session4.tex Tue Jun 29 00:30:21 2010 -0500 +++ b/day2/session4.tex Tue Jun 29 00:59:26 2010 -0500 @@ -202,6 +202,23 @@ \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 @@ \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}