summaryrefslogtreecommitdiff
path: root/day2
diff options
context:
space:
mode:
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}