summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Burns2010-06-29 00:59:26 -0500
committerChristopher Burns2010-06-29 00:59:26 -0500
commitb87e88cf9a2153774ea0f818f6201c5d5cc4a58e (patch)
treeff3fac0d4a39d3591e23d119869a1c7cd128c616
parentf782c00fb6ec34686729cabb345e6eba744fbbad (diff)
downloadworkshops-b87e88cf9a2153774ea0f818f6201c5d5cc4a58e.tar.gz
workshops-b87e88cf9a2153774ea0f818f6201c5d5cc4a58e.tar.bz2
workshops-b87e88cf9a2153774ea0f818f6201c5d5cc4a58e.zip
DOC: Add more slides on testing
--HG-- branch : scipy2010
-rw-r--r--day2/session4.tex29
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}