day2/session3.tex
changeset 60 edfe20d6733c
parent 57 73462010a2fe
child 61 fc495fd7e84e
equal deleted inserted replaced
59:9aac0f128482 60:edfe20d6733c
    20 % h/w = 0.888
    20 % h/w = 0.888
    21 
    21 
    22 
    22 
    23 \mode<presentation>
    23 \mode<presentation>
    24 {
    24 {
    25   \usetheme{CambridgeUS}
    25   \usetheme{Warsaw}
    26   %\usetheme{Boadilla}
    26   %\usetheme{Boadilla}
    27   %\usetheme{default}
    27   %\usetheme{default}
    28   \useoutertheme{split}
    28   \useoutertheme{split}
    29   \setbeamercovered{transparent}
    29   \setbeamercovered{transparent}
    30 }
    30 }
   475     \frametitle{Testing code with \typ{nosetests}}
   475     \frametitle{Testing code with \typ{nosetests}}
   476    
   476    
   477     \begin{itemize}
   477     \begin{itemize}
   478         \item Writing tests is really simple!
   478         \item Writing tests is really simple!
   479 
   479 
   480         \item Using nose
   480         \item Using nose.
   481 
   481 
   482         \item Example!
   482         \item Example!
   483     \end{itemize}
   483     \end{itemize}
   484 \end{frame}
   484 \end{frame}
   485 
   485 
   508 
   508 
   509 if __name__ == '__main__':
   509 if __name__ == '__main__':
   510     import nose
   510     import nose
   511     nose.main()
   511     nose.main()
   512   \end{lstlisting}
   512   \end{lstlisting}
   513 \inctime{15}
   513 \inctime{10}
   514 \end{frame}
   514 \end{frame}
   515 
   515 
   516 \begin{frame}[fragile]
   516 \begin{frame}[fragile]
   517     \frametitle{Example}
   517     \frametitle{Example}
   518     \begin{block}{Problem Statement:}
   518     \begin{block}{Problem Statement:}
   564 
   564 
   565 Tweak the code to pass this test.
   565 Tweak the code to pass this test.
   566 \end{frame}
   566 \end{frame}
   567 
   567 
   568 \begin{frame}[fragile]
   568 \begin{frame}[fragile]
   569     \frametitle{Exercise: Some more tests.}
   569     \frametitle{Lets write some test!}
   570 \begin{lstlisting}    
   570 \begin{lstlisting}    
   571 def test_function_ignore_spaces_in_text():
   571 #for form of equation y=mx+c
   572     input = "ab raca carba"
   572 #given m and c for two equation,
   573     assert is_palindrome(input) == True
   573 #finding the intersection point.
       
   574 def intersect(m1,c1,m2,c2):
       
   575     x = (c2-c1)/(m1-m2)
       
   576     y = m1*x+c1
       
   577     return (x,y)
   574 \end{lstlisting}
   578 \end{lstlisting}
   575 Check
   579 
   576 
   580 Create a simple test for this
   577 \PythonCode{$ nosetests test.py} 
   581 
   578 
   582 function which will make it fail.
   579 Tweak the code to pass this test.
       
   580 
   583 
   581 \inctime{15} 
   584 \inctime{15} 
   582 \end{frame}
   585 \end{frame}
   583 
   586 
       
   587 \section{Summary}
       
   588 \begin{frame}{So we have covered:}
       
   589   \begin{itemize}
       
   590     \item Need for vizualization.
       
   591     \item Tools available.
       
   592     \item How to follow Test Driven Approach.
       
   593   \end{itemize}
       
   594 \end{frame}
       
   595 \begin{frame}
       
   596     \begin{center}
       
   597         \Huge    
       
   598         Thank you!
       
   599     \end{center}
       
   600 \end{frame}
       
   601   
   584 \end{document}
   602 \end{document}
   585 
   603