summaryrefslogtreecommitdiff
path: root/day2
diff options
context:
space:
mode:
authorChristopher Burns2010-06-29 00:59:26 -0500
committerChristopher Burns2010-06-29 00:59:26 -0500
commit08c1e21f429674f0b887552a4ad86acd36402fe4 (patch)
treeff3fac0d4a39d3591e23d119869a1c7cd128c616 /day2
parent22e1ca7385237831eb3e371070b377fe6e467ac2 (diff)
downloadworkshops-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
Diffstat (limited to 'day2')
-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}