I'm trying to learn unit testing with python with assignment 3. I wrote some unit test cases for the function countSubStringMatch(target,key). http://codepad.org/4BgDkOZi The first test sends an error when I run the tests: File "/retrice03/test_ps3a.py", line 6, in testCountSubStringMatch_ok self.assertEqual(countSubStringMatch("atgacatgcacaagtatgcat","atgc"), 2) AssertionError: None != 2 But if I call the function in the standard way, there is no error. Does someone got a clue ?
no clues unless you post your code
Here is the code tested with the above unit tests: http://codepad.org/NyrMWj7i
how about the unittest?
It's in my first post
Solved! The problem was that the unit test was testing an old version of ps3a. It seems that I need to restart the shell sometimes, otherwise old versions of my programs are used. But I don't know if it's a normal behavior with idle...
yea you need to do that - Idle will hold all of the objects in your module(s) in its namespaces. so if you have two modules and one imports the other if you edit the one that is imported you have to restart the other so that it has the curren version of those objects in its namespace. at the idle shell prompt run dir() and you can see all the objects that are currently in its namespace
ok, I noticed that under ubuntu 11.10, when I run idle with the shortcut created by the installer, I don't have the 'shell' menu. To have it, I must run it from the command line. Kind of weird !
Join our real-time social learning platform and learn together with your friends!