When creating python unit tests you need to create a method in a unittest class. The problem however is when you don’t know until the code is running what these tests will be. In my particular case I need to run a series of tests against a number of Solaris packages. But I won’t know what the packages will be in advance. More »

20. October 2011 · 4 comments · Categories: computing, Solaris · Tags:

The simple way to search for a string in a list is just to use ‘if string in list’. eg:

>>> list=['a cat','a dog','a yacht']
>>> string='a cat'
>>> if string in list:
...     print 'found a cat!'
...
found a cat!
>>>

More »