Python for the .NET developer Transcripts
Chapter: Testing
Lecture: Introduction to testing in Python

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Are you ready to make your code more reliable?
0:03 Well we're going to talk about unit testing in Python.
0:06 I just wanted to start this whole chapter
0:08 by saying this is not a sales pitch.
0:09 If you don't want to do unit testing, fine
0:11 don't do it you don't have to
0:14 but if you are interested in doing unit testing
0:16 we're going to go through it
0:18 and show you how it works now in C#.
0:20 And then of course, how we're going to do this in Python.
0:23 Python has great features for testing
0:25 and continuous integration, all those kind of things.
0:29 It's also worth pointing out that in Python
0:31 unit testing is more important than it is in C#.
0:35 Remember, Python doesn't validate the code
0:38 until you try to run it.
0:40 And it could be that the code itself has some problem
0:44 like with a type mismatch for example
0:45 like you're trying to add a string and an integer
0:47 and it's like, no you can only add strings.
0:49 For example, like that would not get detected
0:51 by loading up the code.
0:53 You'd have to actually interact with
0:55 that part of the code to make sure
0:56 that type check effectively is going to to happen.
0:59 In C# we have the compiler, in Python
1:01 you need to do a little bit more
1:03 to make sure it works.
1:04 If you're kind of on the fence
1:05 about unit testing in C# you probably want
1:08 to do at least a little basic unit testing
1:10 over in the Python world so things like
1:12 continuous integration actually make sense.
1:15 I'm sure you've seen graphs like this.
1:17 Testing is good for you and I also laid out why
1:19 in a dynamic language, like Python
1:21 an interpreted language like Python
1:22 it's much more important, even than in say
1:25 something like C#, or Java, or C++.
1:28 Where the compiler does some of the validation for you.