summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-12 19:56:08 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-12 19:56:08 (GMT)
commita60c2fe4807e89a5844979fe46b3ea39572fc3be (patch)
tree0177eec0d55bb6325897ed7a19db9dad2e5df304 /Lib/test/test_descr.py
parent18987a11ce0f8f55aa6ec63a9d2f8e84d7460984 (diff)
downloadcpython-a60c2fe4807e89a5844979fe46b3ea39572fc3be.zip
cpython-a60c2fe4807e89a5844979fe46b3ea39572fc3be.tar.gz
cpython-a60c2fe4807e89a5844979fe46b3ea39572fc3be.tar.bz2
Issue #23641: Cleaned out legacy dunder names from tests and docs.
Fixed 2 to 3 porting bug in pynche.ColorDB.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 1de2a99..9a60a12 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -21,7 +21,8 @@ class OperatorsTest(unittest.TestCase):
'add': '+',
'sub': '-',
'mul': '*',
- 'div': '/',
+ 'truediv': '/',
+ 'floordiv': '//',
'divmod': 'divmod',
'pow': '**',
'lshift': '<<',
@@ -52,8 +53,6 @@ class OperatorsTest(unittest.TestCase):
'invert': '~',
'int': 'int',
'float': 'float',
- 'oct': 'oct',
- 'hex': 'hex',
}
for name, expr in list(self.unops.items()):
@@ -82,12 +81,6 @@ class OperatorsTest(unittest.TestCase):
def binop_test(self, a, b, res, expr="a+b", meth="__add__"):
d = {'a': a, 'b': b}
- # XXX Hack so this passes before 2.3 when -Qnew is specified.
- if meth == "__div__" and 1/2 == 0.5:
- meth = "__truediv__"
-
- if meth == '__divmod__': pass
-
self.assertEqual(eval(expr, d), res)
t = type(a)
m = getattr(t, meth)
@@ -221,7 +214,7 @@ class OperatorsTest(unittest.TestCase):
def number_operators(self, a, b, skip=[]):
dict = {'a': a, 'b': b}
- for name, expr in list(self.binops.items()):
+ for name, expr in self.binops.items():
if name not in skip:
name = "__%s__" % name
if hasattr(a, name):
@@ -261,7 +254,7 @@ class OperatorsTest(unittest.TestCase):
# Testing complex operations...
self.number_operators(100.0j, 3.0j, skip=['lt', 'le', 'gt', 'ge',
'int', 'float',
- 'divmod', 'mod'])
+ 'floordiv', 'divmod', 'mod'])
class Number(complex):
__slots__ = ['prec']
@@ -4160,9 +4153,8 @@ order (MRO) for bases """
('__add__', 'x + y', 'x += y'),
('__sub__', 'x - y', 'x -= y'),
('__mul__', 'x * y', 'x *= y'),
- ('__truediv__', 'operator.truediv(x, y)', None),
- ('__floordiv__', 'operator.floordiv(x, y)', None),
- ('__div__', 'x / y', 'x /= y'),
+ ('__truediv__', 'x / y', 'x /= y'),
+ ('__floordiv__', 'x // y', 'x //= y'),
('__mod__', 'x % y', 'x %= y'),
('__divmod__', 'divmod(x, y)', None),
('__pow__', 'x ** y', 'x **= y'),
@@ -4224,8 +4216,8 @@ order (MRO) for bases """
# Also check type_getattro for correctness.
class Meta(type):
pass
- class X(object):
- __metaclass__ = Meta
+ class X(metaclass=Meta):
+ pass
X.a = 42
Meta.a = Descr("a")
self.assertEqual(X.a, 42)