Mercurial > pylearn
view _test_lookup_list.py @ 324:ce79bf5fa463
- the cut and paste between file and dir conditions is always a bad thing
- i made one function (hg_version) to basically call and parse hg
- i made a function to include the cases of what might be returned by
imp.find_modules (_input_id)
- the check for a .hg folder was insufficient. Lots of things could go wrong.
Instead I use the return code from the Popen process. The return code
catches this and any other problem that hg runs into.
- its easier to offer more rcs support in future (cvs,svn,git)
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Thu, 12 Jun 2008 20:54:49 -0400 |
parents | 29f394813c3c |
children |
line wrap: on
line source
from lookup_list import * import unittest class T_LookUpList(unittest.TestCase): def test_LookupList(self): #test only the example in the doc??? example = LookupList(['x','y','z'],[1,2,3]) example['x'] = [1, 2, 3] # set or change a field x, y, z = example x = example[0] x = example["x"] assert example.keys()==['x','y','z'] assert example.values()==[[1,2,3],2,3] assert example.items()==[('x',[1,2,3]),('y',2),('z',3)] example.append_keyval('u',0) # adds item with name 'u' and value 0 assert len(example)==4 # number of items = 4 here example2 = LookupList(['v','w'], ['a','b']) example3 = LookupList(['x','y','z','u','v','w'], [[1, 2, 3],2,3,0,'a','b']) assert example+example2==example3 self.assertRaises(AssertionError,example.__add__,example) del example, example2, example3, x, y ,z if __name__=='__main__': unittest.main()