diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-21 17:06:07 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-21 17:06:07 (GMT) |
commit | 4886cc331ff158f8ede74878a436adfad205bd2d (patch) | |
tree | e9473cb0fd8449b2bdfcea9826e5c795e6ba87e2 /Lib | |
parent | 79212998a8d46712edcf7c4f3fbaefca05a7b08b (diff) | |
download | cpython-4886cc331ff158f8ede74878a436adfad205bd2d.zip cpython-4886cc331ff158f8ede74878a436adfad205bd2d.tar.gz cpython-4886cc331ff158f8ede74878a436adfad205bd2d.tar.bz2 |
Get rid of most of the rest of coerce (slot is still there for now).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_builtin.py | 11 | ||||
-rw-r--r-- | Lib/test/test_complex.py | 3 | ||||
-rw-r--r-- | Lib/test/test_descr.py | 35 |
3 files changed, 2 insertions, 47 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 5797aef..13a5241 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -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' diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index 035f524..4aa799d 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -92,9 +92,6 @@ class ComplexTest(unittest.TestCase): self.assertAlmostEqual(complex.__floordiv__(3+0j, 1.5+0j), 2) self.assertRaises(ZeroDivisionError, complex.__floordiv__, 3+0j, 0+0j) - def test_coerce(self): - self.assertRaises(OverflowError, complex.__coerce__, 1+1j, 1L<<10000) - def test_richcompare(self): self.assertRaises(OverflowError, complex.__eq__, 1+1j, 1L<<10000) self.assertEqual(complex.__lt__(1+1j, None), NotImplemented) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 01fd685..00800a7 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2567,33 +2567,6 @@ def rich_comparisons(): verify(eval("x %s c[y]" % op) == eval("x %s y" % op), "x=%d, y=%d" % (x, y)) -def coercions(): - if verbose: print "Testing coercions..." - class I(int): pass - coerce(I(0), 0) - coerce(0, I(0)) - class L(long): pass - coerce(L(0), 0) - coerce(L(0), 0L) - coerce(0, L(0)) - coerce(0L, L(0)) - class F(float): pass - coerce(F(0), 0) - coerce(F(0), 0L) - coerce(F(0), 0.) - coerce(0, F(0)) - coerce(0L, F(0)) - coerce(0., F(0)) - class C(complex): pass - coerce(C(0), 0) - coerce(C(0), 0L) - coerce(C(0), 0.) - coerce(C(0), 0j) - coerce(0, C(0)) - coerce(0L, C(0)) - coerce(0., C(0)) - coerce(0j, C(0)) - def descrdoc(): if verbose: print "Testing descriptor doc strings..." def check(descr, what): @@ -3961,11 +3934,8 @@ def notimplemented(): ('__and__', 'x & y', 'x &= y'), ('__or__', 'x | y', 'x |= y'), ('__xor__', 'x ^ y', 'x ^= y'), - ('__coerce__', 'coerce(x, y)', None)]: - if name == '__coerce__': - rname = name - else: - rname = '__r' + name[2:] + ]: + rname = '__r' + name[2:] A = metaclass('A', (), {name: specialmethod}) B = metaclass('B', (), {rname: specialmethod}) a = A() @@ -4043,7 +4013,6 @@ def test_main(): str_subclass_as_dict_key() classic_comparisons() rich_comparisons() - coercions() descrdoc() setclass() setdict() |