Python for .NET Developers 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? Well we're going to talk about unit testing in Python. I just wanted to start this whole chapter
0:09
by saying this is not a sales pitch. If you don't want to do unit testing, fine don't do it you don't have to
0:15
but if you are interested in doing unit testing we're going to go through it and show you how it works now in C#.
0:21
And then of course, how we're going to do this in Python. Python has great features for testing and continuous integration, all those kind of things.
0:30
It's also worth pointing out that in Python unit testing is more important than it is in C#. Remember, Python doesn't validate the code
0:39
until you try to run it. And it could be that the code itself has some problem like with a type mismatch for example
0:46
like you're trying to add a string and an integer and it's like, no you can only add strings. For example, like that would not get detected
0:52
by loading up the code. You'd have to actually interact with that part of the code to make sure that type check effectively is going to to happen.
1:00
In C# we have the compiler, in Python you need to do a little bit more to make sure it works. If you're kind of on the fence
1:06
about unit testing in C# you probably want to do at least a little basic unit testing over in the Python world so things like
1:13
continuous integration actually make sense. I'm sure you've seen graphs like this. Testing is good for you and I also laid out why
1:20
in a dynamic language, like Python an interpreted language like Python it's much more important, even than in say something like C#, or Java, or C++.
1:29
Where the compiler does some of the validation for you.