From: <pj...@us...> - 2008-10-21 18:44:14
|
Revision: 5498 http://jython.svn.sourceforge.net/jython/?rev=5498&view=rev Author: pjenvey Date: 2008-10-21 18:44:08 +0000 (Tue, 21 Oct 2008) Log Message: ----------- IOErrors are expected for unsupported file operations, instead of TypeErrors Modified Paths: -------------- trunk/jython/Lib/test/test_java_integration.py trunk/jython/src/org/python/core/io/IOBase.java Modified: trunk/jython/Lib/test/test_java_integration.py =================================================================== --- trunk/jython/Lib/test/test_java_integration.py 2008-10-21 10:53:16 UTC (rev 5497) +++ trunk/jython/Lib/test/test_java_integration.py 2008-10-21 18:44:08 UTC (rev 5498) @@ -154,6 +154,10 @@ from java.io import FileInputStream, FileNotFoundException self.assertRaises(FileNotFoundException, FileInputStream, "garbage") + def test_unsupported(self): + fp = open(System.out) + self.assertRaises(IOError, fp.tell) + class VectorTest(unittest.TestCase): def test_looping(self): Modified: trunk/jython/src/org/python/core/io/IOBase.java =================================================================== --- trunk/jython/src/org/python/core/io/IOBase.java 2008-10-21 10:53:16 UTC (rev 5497) +++ trunk/jython/src/org/python/core/io/IOBase.java 2008-10-21 18:44:08 UTC (rev 5498) @@ -210,6 +210,6 @@ protected void unsupported(String methodName) { String qualifiedName = getClass().getName(); String className = qualifiedName.substring(qualifiedName.lastIndexOf('.') + 1); - throw Py.TypeError(String.format("%s.%s() not supported", className, methodName)); + throw Py.IOError(String.format("%s.%s() not supported", className, methodName)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |