def __setitem__(self, key, value): theKey = rands(10) filePath = self.dirPath + '/' + theKey self._paths[key] = filePath if isinstance(value, Picklable): value.save(filePath) else: f = open(filePath, 'w') try: cPickle.dump(value, f) finally: f.close() self._paths[key] = filePath self._classes[key] = value.__class__
def test_rands(): r = pytools.rands(10) assert(len(r) == 10)
def test_rands(): r = pytools.rands(10) assert (len(r) == 10)