mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Get rid of most of the rest of coerce (slot is still there for now).
This commit is contained in:
parent
79212998a8
commit
4886cc331f
19 changed files with 131 additions and 497 deletions
|
@ -196,17 +196,6 @@ class BuiltinTest(unittest.TestCase):
|
|||
a.pop(); b.pop(); c.pop()
|
||||
self.assertRaises(TypeError, cmp)
|
||||
|
||||
def test_coerce(self):
|
||||
self.assert_(not fcmp(coerce(1, 1.1), (1.0, 1.1)))
|
||||
self.assertEqual(coerce(1, 1L), (1L, 1L))
|
||||
self.assert_(not fcmp(coerce(1L, 1.1), (1.0, 1.1)))
|
||||
self.assertRaises(TypeError, coerce)
|
||||
class BadNumber:
|
||||
def __coerce__(self, other):
|
||||
raise ValueError
|
||||
self.assertRaises(ValueError, coerce, 42, BadNumber())
|
||||
self.assertRaises(OverflowError, coerce, 0.5, int("12345" * 1000))
|
||||
|
||||
def test_compile(self):
|
||||
compile('print 1\n', '', 'exec')
|
||||
bom = '\xef\xbb\xbf'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue