Skip to content
Snippets Groups Projects
Commit 3b3fe62a authored by Steven Palmer's avatar Steven Palmer
Browse files

Small fixes to T05

parent b1e647b7
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -143,7 +143,7 @@ No one likes to work with someone who doesn't verify/test if their code works.}
\begin{itemize}
\item{pytest is a framework that maeks it easy to write small tests}
\item{Similar to JUnit (Java), CppUnit (C++)}
\item{Knowledge is transferrable to another xUnit framework regardless of language}
\item{Knowledge is transferable to another xUnit framework regardless of language}
\end{itemize}
\end{frame}
......@@ -173,9 +173,8 @@ No one likes to work with someone who doesn't verify/test if their code works.}
\begin{frame}[fragile]
\frametitle{Create our first unit test file}
\begin{itemize}
\item{To start, create a new Python file in the same directory of our file that we want to test}
\item{You can do this from the command line or any text editor of your choiceDon't be afraid to ask any questions!}
\item{\texttt{echo $> >$ test\_circles.py}}
\item{To start, create a new Python file called test\_circles.py in the same directory of our file that we want to test}
\item{You can do this from the command line or any text editor of your choice. Don't be afraid to ask any questions!}
\end{itemize}
\end{frame}
......@@ -198,8 +197,8 @@ No one likes to work with someone who doesn't verify/test if their code works.}
\begin{frame}[fragile]
\frametitle{What is Assert?}
\begin{itemize}
\item{ Wikipedia: \say{... is a statement that a predicate (Boolean-valued function, i.e. a true-false expression) is expected to always be true at that point in the code. If an assertion evaluates to false at run time, an assertion failure results, which typically causes the program to crash, or to throw an assertion exception.}}
\item{Basically, if whatever follows assert is true, it will continue. Otherwise the test will fail and stop running.
\item{ Wikipedia: \say{... an assertion is a statement that a predicate (Boolean-valued function, i.e. a true-false expression) is expected to always be true at that point in the code. If an assertion evaluates to false at run time, an assertion failure results, which typically causes the program to crash, or to throw an assertion exception.}}
\item{Basically, if whatever follows assert is true, it will continue. Otherwise the test will fail and stop running.}
\end{itemize}
\end{frame}
......@@ -212,7 +211,7 @@ No one likes to work with someone who doesn't verify/test if their code works.}
\end{lstlisting}
\item{To assert something to be false, you can write}
\begin{lstlisting}[language=Python]
assert (<false statement>) == False
assert not <false statement>
\end{lstlisting}
......@@ -234,7 +233,8 @@ class TestCircles:
def test_xcoord_are_not_equal(self):
circle = CircleT(1,2,3)
assert not(circle.xcoord() != 1)
assert not (circle.xcoord() == 2)
# or `assert circle.xcoord() != 2'
\end{lstlisting}
\end{frame}
......@@ -281,10 +281,10 @@ class TestCircles:
\begin{frame}[fragile]
\frametitle{Floating Point assertsions}
\begin{itemize}
%\begin{itemize}
\end{itemize}
%\end{itemize}
\end{frame}
\begin{frame}[fragile]
......
......@@ -25,4 +25,4 @@ class TestCircles:
assert self.circle.xcoord() == 1
def test_xcoord_are_not_equal(self):
assert not(self.circle.xcoord() != 1)
\ No newline at end of file
assert self.circle.xcoord() != 2
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment