Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r57944:55199747a938
Date: 2012-10-08 15:48 -0700
http://bitbucket.org/pypy/pypy/changeset/55199747a938/

Log:    test range's handling of __index__, __int__ is no longer supported

diff --git a/pypy/module/__builtin__/test/test_functional.py 
b/pypy/module/__builtin__/test/test_functional.py
--- a/pypy/module/__builtin__/test/test_functional.py
+++ b/pypy/module/__builtin__/test/test_functional.py
@@ -121,15 +121,20 @@
       # test again, to make sure that range() is not its own iterator
       assert iter(x).__next__() == 2
 
-   def test_range_object_with___int__(self):
+   def test_range_object_with___index__(self):
        class A(object):
-          def __int__(self):
+          def __index__(self):
              return 5
 
        assert list(range(A())) == [0, 1, 2, 3, 4]
        assert list(range(0, A())) == [0, 1, 2, 3, 4]
        assert list(range(0, 10, A())) == [0, 5]
 
+       class A2(object):
+          def __index__(self):
+             return 'quux'
+       raises(TypeError, range, A2())
+
    def test_range_float(self):
       raises(TypeError, "range(0.1, 2.0, 1.1)")
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to