Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r67054:a82f83c4d0a0 Date: 2013-09-22 15:33 +0200 http://bitbucket.org/pypy/pypy/changeset/a82f83c4d0a0/
Log: Issue #1612: Add operator.__index__(). diff --git a/pypy/module/operator/__init__.py b/pypy/module/operator/__init__.py --- a/pypy/module/operator/__init__.py +++ b/pypy/module/operator/__init__.py @@ -50,6 +50,7 @@ '__concat__' : 'concat', '__contains__' : 'contains', 'sequenceIncludes' : 'contains', + '__index__' : 'index', '__delitem__' : 'delitem', '__div__' : 'div', '__eq__' : 'eq', diff --git a/pypy/module/operator/test/test_operator.py b/pypy/module/operator/test/test_operator.py --- a/pypy/module/operator/test/test_operator.py +++ b/pypy/module/operator/test/test_operator.py @@ -190,3 +190,9 @@ assert methodcaller("method", 4)(x) == (4, 3) assert methodcaller("method", 4, 5)(x) == (4, 5) assert methodcaller("method", 4, arg2=42)(x) == (4, 42) + + def test_index(self): + import operator + assert operator.index(42) == 42 + assert operator.__index__(42) == 42 + raises(TypeError, operator.index, "abc") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit