Name: [171] Florian Mayer
Member: 114 months
Authored: 7 videos
Description: I'm a student from Vienna, the federal capital of Austria. Please visit `My Blog <>`_ ...

Basic Unittesting with Python [ID:765] (1/2)

in series: Unittesting with Python

video tutorial by Florian Mayer, added 06/08

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

This video will teach you the absolute basics of Python unittesting.

It will teach you how to test your applicating using unittests.

import unittest
import random
import string
import string_functions

class CheckStringFunctions(unittest.TestCase):
	def testOrd(self):
		rand_char = random.choice(string.letters)
		rand_char_ord = string_functions.get_ord(rand_char)
		new_char = string_functions.get_char(rand_char_ord)
		self.assertEqual(rand_char, new_char)

class CheckNumbers(unittest.TestCase):
	def testInt(self):
		self.assertEqual(2, 2)

if __name__ == "__main__":
def get_ord(char):
	return ord(char) # WRONG

def get_char(nmb):
	return chr(nmb)

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 32 (since July 30th)
  • Plays in last week: 0
  • Published: 98 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>

All comments excluding tick-boxed quick-comments

Great Job, Thanks

27. mbt outlet napoli Sun, 30 May 2010 22:57

Well done. One thing that might improve it further is doing two screencasts, -one for beginners in python unittesting and one for beginners in unittesting.

26. jasa SEO, Backlink, Blogwalking murah Sun, 21 Mar 2010 15:39

Good video, but very basic. looking forward to more advanced examples with a more realistic library.

25. MarthaKr Thu, 18 Feb 2010 10:07

Very helping - keep it up!

24. anonymous Thu, 17 Dec 2009 06:33

Very cool quick intro - just enough to give the flavor of the topic. Thanks!

23. anonymous Tue, 24 Nov 2009 13:29

Great Video. Keep up the good work.

22. anonymous Mon, 16 Nov 2009 22:54

Thank you, very clear!

21. anonymous Fri, 30 Oct 2009 23:33

Thanks, I have a better understanding of what unittest is now.

20. anonymous Wed, 14 Oct 2009 14:43

Great video for introduction into the unittest,

19. anonymous Fri, 21 Aug 2009 08:34

Great intro to unit testing in Python. Keep up the good work!

18. anonymous Wed, 22 Jul 2009 12:14

Thanks so much for your simple tutorial man! You guys that do this are a great resource to everyone else!


17. anonymous Wed, 22 Jul 2009 12:09

Thanks so much for your simple tutorial man! You guys that do this are a great resource to everyone else!


16. anonymous Thu, 16 Jul 2009 18:13

Nice clear introduction!

I am trying to teach some people unit testing and you did a good job laying things out.

15. anonymous Thu, 07 May 2009 06:11

How to run more than 1 test cases at the time. Means many test case should get run at once.

How to run test suite?

Can you please guide me through mail or any video tutorial.

Python unit testing using Eclipse IDE.

The next tutorial is already published as the continuation of this one. So you do not need to await it. Be sure to leave me some feedback for that one.

Thank you very much, I succeed... I await Your next tutorial, and thanks one more time!

Regards Try downloading the original version from here if you can't watch the full video. Thanks for the feedback and be sure to watch my continuation of the series "Test Driven Development by Example".

Thanks very much, but video is broken, only about 30 % of video can be showed (online and with downloaded .flv)...

Is this happened only to me or...?


Then you might have misunderstood the title. It says "Basic Unittesting with Python", meaning it's more about how to write unittests than when to. I might come to talk about "Test-Driven Development" in a sequel of this video.

Sorry for not meeting your expectations, but stay tuned, I might make a screencast about just the thing you wanted.

To the others, thanks for the positive feedback.

9. anonymous Tue, 05 Aug 2008 10:41

I saw this video and was excited because I wanted to be able to link my students to a showmedo about python unit testing. However, I can't link them to this because you did not follow proper TDD practice of writing the tests first and then writing the code. I know it may seem a bit picky, but it is a big deal imo.

You need the xvid codec to view the original version of the video. If you are a Windows user, it can be obtainned with the "K-Lite codec pack", at least that's what I used to see whether it can be viewed in Windows.

Thanks for the positive feedback, I will consider making a second video showing some more advanced features of unittesting.

And there's the code right on this page! Great!

I did download the original version, but don't have the necessary codec(?) to watch it.

Because the code is a bit hard to read, could a link to it be provided?

First thanks for the positive feedback.

Second, no I don't really notice that the text is very difficult to read, it is a bit small, I admit, but for me it is readable. Maybe my eyes are better than I thought they were.

If you really cannot read it and still want to see it, just download the original 800x600 version from

Florian, I don't know if you noticed it but it is very difficult to read the text you write.

2. anonymous Mon, 30 Jun 2008 14:00

hi florian

very clear and nice tutorial thanks for that!

Video published, thanks for contributing to ShowMeDo

Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Florian

Decorators: Introducing functools.wraps


maccosmeticswholesalers mac makeup pencil c 17
72 months ago


Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.