From: <pj...@us...> - 2008-07-31 23:59:27
|
Revision: 5039 http://jython.svn.sourceforge.net/jython/?rev=5039&view=rev Author: pjenvey Date: 2008-07-31 23:59:25 +0000 (Thu, 31 Jul 2008) Log Message: ----------- o filter operator slice args through __index__ o workaround Jython's lack of a real repeat/concat binop in test_operator Modified Paths: -------------- branches/asm/Lib/test/test_operator.py branches/asm/src/org/python/modules/operator.java Modified: branches/asm/Lib/test/test_operator.py =================================================================== --- branches/asm/Lib/test/test_operator.py 2008-07-31 23:57:11 UTC (rev 5038) +++ branches/asm/Lib/test/test_operator.py 2008-07-31 23:59:25 UTC (rev 5039) @@ -122,7 +122,9 @@ self.failUnless(operator.concat([1, 2], [3, 4]) == [1, 2, 3, 4]) self.failUnless(operator.concat(Seq1([5, 6]), Seq1([7])) == [5, 6, 7]) self.failUnless(operator.concat(Seq2([5, 6]), Seq2([7])) == [5, 6, 7]) - self.failUnlessRaises(TypeError, operator.concat, 13, 29) + if not test_support.is_jython: + # Jython concat is add + self.failUnlessRaises(TypeError, operator.concat, 13, 29) def test_countOf(self): self.failUnlessRaises(TypeError, operator.countOf) @@ -291,7 +293,9 @@ self.failUnless(operator.repeat(a, 2) == [4, 5, 6, 4, 5, 6]) self.failUnless(operator.repeat(a, 1) == [4, 5, 6]) self.failUnless(operator.repeat(a, 0) == []) - self.failUnlessRaises(TypeError, operator.repeat, 6, 7) + if not test_support.is_jython: + # Jython repeat is mul + self.failUnlessRaises(TypeError, operator.repeat, 6, 7) def test_rshift(self): self.failUnlessRaises(TypeError, operator.rshift) Modified: branches/asm/src/org/python/modules/operator.java =================================================================== --- branches/asm/src/org/python/modules/operator.java 2008-07-31 23:57:11 UTC (rev 5038) +++ branches/asm/src/org/python/modules/operator.java 2008-07-31 23:59:25 UTC (rev 5039) @@ -85,8 +85,8 @@ public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3) { switch (index) { - case 22: arg1.__delslice__(arg2, arg3); return Py.None; - case 24: return arg1.__getslice__(arg2, arg3); + case 22: arg1.__delslice__(arg2.__index__(), arg3.__index__()); return Py.None; + case 24: return arg1.__getslice__(arg2.__index__(), arg3.__index__()); case 25: arg1.__setitem__(arg2, arg3); return Py.None; default: throw info.unexpectedCall(3, false); @@ -98,7 +98,7 @@ { switch (index) { case 26: - arg1.__setslice__(arg2, arg3, arg4); + arg1.__setslice__(arg2.__index__(), arg3.__index__(), arg4); return Py.None; default: throw info.unexpectedCall(4, false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |