diff options
author | Trent Nelson <trent.nelson@snakebite.org> | 2008-04-10 16:25:37 +0000 |
---|---|---|
committer | Trent Nelson <trent.nelson@snakebite.org> | 2008-04-10 16:25:37 +0000 |
commit | e2ae4684a5617ec5bc8d48e09af2dd7a24711f23 (patch) | |
tree | 4b065c8f03e00df65181af57df668136d3d8f0ed /Lib/test/test_getargs2.py | |
parent | 5680d0c5e3a9d42b6c21f4a31a7dbfe72c9e5170 (diff) | |
download | cpython-git-e2ae4684a5617ec5bc8d48e09af2dd7a24711f23.tar.gz |
Issue 2440: fix the handling of %n in Python/getargs.c's convertsimple(), extend Objects/abstract.c's PyNumber_Index() to accept PyObjects that have nb_int slots, and update test_getargs2 to test that an exception is thrown when __int__() returns a non-int object.
Diffstat (limited to 'Lib/test/test_getargs2.py')
-rw-r--r-- | Lib/test/test_getargs2.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py index 19183867f9..d8f6309239 100644 --- a/Lib/test/test_getargs2.py +++ b/Lib/test/test_getargs2.py @@ -63,6 +63,10 @@ class Int: def __int__(self): return 99 +class InvalidLongAsString: + def __int__(self): + return 'foobar' + class Unsigned_TestCase(unittest.TestCase): def test_b(self): from _testcapi import getargs_b @@ -199,6 +203,7 @@ class Signed_TestCase(unittest.TestCase): self.failUnlessEqual(42, getargs_n(42)) self.assertRaises(OverflowError, getargs_n, VERY_LARGE) + self.assertRaises(TypeError, getargs_n, InvalidLongAsString()) class LongLong_TestCase(unittest.TestCase): def test_L(self): |