def test_odata_directory(self): """Test that conversions to output files work properly""" print "starting" IMP.set_log_level(IMP.MEMORY) IMP._test_ofile("ofile_test") self.assertRaises(IOError, IMP._test_ofile, "nodir/hi" ) f= open("hi", "w") IMP._test_ofile(f) s = StringIO() IMP._test_ofile(s) self.assertTrue(s.getvalue().startswith("hi\n")) self.assertRaises(TypeError, IMP._test_ofile, 1) class NoMethods(object): pass self.assertRaises(TypeError, IMP._test_ofile, NoMethods) del f print "unlinking" #os.unlink('ofile_test') #os.unlink('hi') print "done"