def test_save(): class TestLoadClass(KeyedObject): def __init__(self,key='dummy',attr1='a1',attr2='a2'): KeyedObject.__init__(self,key=key) self.attr1 = attr1 self.attr2 = attr2 set_of_keyed_objects = SetOfKeyedObjects(TestLoadClass) instance = set_of_keyed_objects.cls(key='2') set_of_keyed_objects.objects['2'] = instance set_of_keyed_objects.__save__(base_dir=os.path.join(os.getcwd(),'mockdb/test_data'))
def test_class_set_method(): class TestLoadClass(KeyedObject): def __init__(self,key='dummy',attr1='a1',attr2='a2'): KeyedObject.__init__(self,key=key) self.attr1 = attr1 self.attr2 = attr2 set_of_keyed_objects = SetOfKeyedObjects(TestLoadClass) instance = set_of_keyed_objects.cls(key='2') set_of_keyed_objects.objects['2'] = instance clses = set_of_keyed_objects.__class_set__() if clses != set([set_of_keyed_objects.cls]): print "class_set_method failed."