Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a60c2fe4
Commit
a60c2fe4
authored
Mar 12, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #23641: Cleaned out legacy dunder names from tests and docs.
Fixed 2 to 3 porting bug in pynche.ColorDB.
parent
18987a11
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
72 additions
and
124 deletions
+72
-124
Doc/library/multiprocessing.rst
Doc/library/multiprocessing.rst
+1
-1
Doc/library/unittest.mock.rst
Doc/library/unittest.mock.rst
+6
-6
Lib/datetime.py
Lib/datetime.py
+4
-3
Lib/decimal.py
Lib/decimal.py
+5
-6
Lib/sqlite3/test/types.py
Lib/sqlite3/test/types.py
+3
-12
Lib/test/mapping_tests.py
Lib/test/mapping_tests.py
+1
-1
Lib/test/test_abc.py
Lib/test/test_abc.py
+2
-2
Lib/test/test_augassign.py
Lib/test/test_augassign.py
+0
-8
Lib/test/test_class.py
Lib/test/test_class.py
+24
-10
Lib/test/test_descr.py
Lib/test/test_descr.py
+8
-16
Lib/test/test_dynamicclassattribute.py
Lib/test/test_dynamicclassattribute.py
+2
-2
Lib/test/test_inspect.py
Lib/test/test_inspect.py
+1
-1
Lib/test/test_itertools.py
Lib/test/test_itertools.py
+1
-1
Lib/test/test_property.py
Lib/test/test_property.py
+2
-2
Lib/test/test_unicode.py
Lib/test/test_unicode.py
+9
-47
Modules/_decimal/tests/deccheck.py
Modules/_decimal/tests/deccheck.py
+1
-1
Modules/mathmodule.c
Modules/mathmodule.c
+1
-1
Tools/clinic/clinic.py
Tools/clinic/clinic.py
+0
-1
Tools/pynche/ColorDB.py
Tools/pynche/ColorDB.py
+1
-3
No files found.
Doc/library/multiprocessing.rst
View file @
a60c2fe4
...
@@ -1831,7 +1831,7 @@ itself. This means, for example, that one shared object can contain a second:
...
@@ -1831,7 +1831,7 @@ itself. This means, for example, that one shared object can contain a second:
>>>
l
=
manager
.
list
(
range
(
10
))
>>>
l
=
manager
.
list
(
range
(
10
))
>>>
l
.
_callmethod
(
'__len__'
)
>>>
l
.
_callmethod
(
'__len__'
)
10
10
>>>
l
.
_callmethod
(
'__get
slice__'
,
(
2
,
7
))
#
equiv
to
`
l
[
2
:
7
]`
>>>
l
.
_callmethod
(
'__get
item__'
,
(
slice
(
2
,
7
),))
#
equiv
to
`
l
[
2
:
7
]`
[
2
,
3
,
4
,
5
,
6
]
[
2
,
3
,
4
,
5
,
6
]
>>>
l
.
_callmethod
(
'__getitem__'
,
(
20
,))
#
equiv
to
`
l
[
20
]`
>>>
l
.
_callmethod
(
'__getitem__'
,
(
20
,))
#
equiv
to
`
l
[
20
]`
Traceback
(
most
recent
call
last
):
Traceback
(
most
recent
call
last
):
...
...
Doc/library/unittest.mock.rst
View file @
a60c2fe4
...
@@ -1579,19 +1579,19 @@ The full list of supported magic methods is:
...
@@ -1579,19 +1579,19 @@ The full list of supported magic methods is:
* ``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``
* ``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``
* ``__dir__``, ``__format__`` and ``__subclasses__``
* ``__dir__``, ``__format__`` and ``__subclasses__``
* ``__floor__``, ``__trunc__`` and ``__ceil__``
* ``__floor__``, ``__trunc__`` and ``__ceil__``
* Comparisons: ``__
cmp__``, ``__
lt__``, ``__gt__``, ``__le__``, ``__ge__``,
* Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``,
``__eq__`` and ``__ne__``
``__eq__`` and ``__ne__``
* Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``,
* Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``,
``__contains__``, ``__len__``, ``__iter__``, ``__
getslice__``,
``__contains__``, ``__len__``, ``__iter__``, ``__
reversed__``
``__setslice__``, ``__reversed__``
and ``__missing__``
and ``__missing__``
* Context manager: ``__enter__`` and ``__exit__``
* Context manager: ``__enter__`` and ``__exit__``
* Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``
* Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``
* The numeric methods (including right hand and in-place variants):
* The numeric methods (including right hand and in-place variants):
``__add__``, ``__sub__``, ``__mul__``, ``__div__``,
``__add__``, ``__sub__``, ``__mul__``, ``__div__``,
``__truediv__``,
``__floordiv__``, ``__mod__``, ``__divmod__``, ``__lshift__``,
``__floordiv__``, ``__mod__``, ``__divmod__``, ``__lshift__``,
``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and ``__pow__``
``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and ``__pow__``
* Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__``
,
* Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__``
``__index__`` and ``__coerce
__``
and ``__index
__``
* Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``
* Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``
* Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``,
* Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``,
``__getnewargs__``, ``__getstate__`` and ``__setstate__``
``__getnewargs__``, ``__getstate__`` and ``__setstate__``
...
...
Lib/datetime.py
View file @
a60c2fe4
...
@@ -646,7 +646,7 @@ class date:
...
@@ -646,7 +646,7 @@ class date:
Operators:
Operators:
__repr__, __str__
__repr__, __str__
__
cmp
__, __hash__
__
eq__, __le__, __lt__, __ge__, __gt
__, __hash__
__add__, __radd__, __sub__ (add/radd only with timedelta arg)
__add__, __radd__, __sub__ (add/radd only with timedelta arg)
Methods:
Methods:
...
@@ -776,7 +776,8 @@ class date:
...
@@ -776,7 +776,8 @@ class date:
"""day (1-31)"""
"""day (1-31)"""
return
self
.
_day
return
self
.
_day
# Standard conversions, __cmp__, __hash__ (and helpers)
# Standard conversions, __eq__, __le__, __lt__, __ge__, __gt__,
# __hash__ (and helpers)
def
timetuple
(
self
):
def
timetuple
(
self
):
"Return local time tuple compatible with time.localtime()."
"Return local time tuple compatible with time.localtime()."
...
@@ -1005,7 +1006,7 @@ class time:
...
@@ -1005,7 +1006,7 @@ class time:
Operators:
Operators:
__repr__, __str__
__repr__, __str__
__
cmp
__, __hash__
__
eq__, __le__, __lt__, __ge__, __gt
__, __hash__
Methods:
Methods:
...
...
Lib/decimal.py
View file @
a60c2fe4
...
@@ -967,13 +967,12 @@ class Decimal(object):
...
@@ -967,13 +967,12 @@ class Decimal(object):
return
self
.
_cmp
(
other
)
>=
0
return
self
.
_cmp
(
other
)
>=
0
def
compare
(
self
,
other
,
context
=
None
):
def
compare
(
self
,
other
,
context
=
None
):
"""Compare
s one to another.
"""Compare
self to other. Return a decimal value:
-1 => a < b
a or b is a NaN ==> Decimal('NaN')
0 => a = b
a < b ==> Decimal('-1')
1 => a > b
a == b ==> Decimal('0')
NaN => one is NaN
a > b ==> Decimal('1')
Like __cmp__, but returns Decimal instances.
"""
"""
other
=
_convert_other
(
other
,
raiseit
=
True
)
other
=
_convert_other
(
other
,
raiseit
=
True
)
...
...
Lib/sqlite3/test/types.py
View file @
a60c2fe4
...
@@ -88,19 +88,10 @@ class DeclTypesTests(unittest.TestCase):
...
@@ -88,19 +88,10 @@ class DeclTypesTests(unittest.TestCase):
_val
=
_val
.
decode
(
'utf-8'
)
_val
=
_val
.
decode
(
'utf-8'
)
self
.
val
=
_val
self
.
val
=
_val
def
__cmp__
(
self
,
other
):
if
not
isinstance
(
other
,
DeclTypesTests
.
Foo
):
raise
ValueError
if
self
.
val
==
other
.
val
:
return
0
else
:
return
1
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
c
=
self
.
__cmp__
(
other
)
if
not
isinstance
(
other
,
DeclTypesTests
.
Foo
):
if
c
is
NotImplemented
:
return
NotImplemented
return
c
return
self
.
val
==
other
.
val
return
c
==
0
def
__conform__
(
self
,
protocol
):
def
__conform__
(
self
,
protocol
):
if
protocol
is
sqlite
.
PrepareProtocol
:
if
protocol
is
sqlite
.
PrepareProtocol
:
...
...
Lib/test/mapping_tests.py
View file @
a60c2fe4
...
@@ -64,7 +64,7 @@ class BasicTestMappingProtocol(unittest.TestCase):
...
@@ -64,7 +64,7 @@ class BasicTestMappingProtocol(unittest.TestCase):
self
.
assertEqual
(
d
,
d
)
self
.
assertEqual
(
d
,
d
)
self
.
assertNotEqual
(
p
,
d
)
self
.
assertNotEqual
(
p
,
d
)
self
.
assertNotEqual
(
d
,
p
)
self
.
assertNotEqual
(
d
,
p
)
#
__non__zero__
#
bool
if
p
:
self
.
fail
(
"Empty mapping must compare to False"
)
if
p
:
self
.
fail
(
"Empty mapping must compare to False"
)
if
not
d
:
self
.
fail
(
"Full mapping must compare to True"
)
if
not
d
:
self
.
fail
(
"Full mapping must compare to True"
)
# keys(), items(), iterkeys() ...
# keys(), items(), iterkeys() ...
...
...
Lib/test/test_abc.py
View file @
a60c2fe4
...
@@ -194,9 +194,9 @@ class TestABC(unittest.TestCase):
...
@@ -194,9 +194,9 @@ class TestABC(unittest.TestCase):
# check that the property's __isabstractmethod__ descriptor does the
# check that the property's __isabstractmethod__ descriptor does the
# right thing when presented with a value that fails truth testing:
# right thing when presented with a value that fails truth testing:
class
NotBool
(
object
):
class
NotBool
(
object
):
def
__
nonzero
__
(
self
):
def
__
bool
__
(
self
):
raise
ValueError
()
raise
ValueError
()
__len__
=
__
nonzero
__
__len__
=
__
bool
__
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
(
ValueError
):
class
F
(
C
):
class
F
(
C
):
def
bar
(
self
):
def
bar
(
self
):
...
...
Lib/test/test_augassign.py
View file @
a60c2fe4
...
@@ -136,14 +136,6 @@ class AugAssignTest(unittest.TestCase):
...
@@ -136,14 +136,6 @@ class AugAssignTest(unittest.TestCase):
output
.
append
(
"__imul__ called"
)
output
.
append
(
"__imul__ called"
)
return
self
return
self
def
__div__
(
self
,
val
):
output
.
append
(
"__div__ called"
)
def
__rdiv__
(
self
,
val
):
output
.
append
(
"__rdiv__ called"
)
def
__idiv__
(
self
,
val
):
output
.
append
(
"__idiv__ called"
)
return
self
def
__floordiv__
(
self
,
val
):
def
__floordiv__
(
self
,
val
):
output
.
append
(
"__floordiv__ called"
)
output
.
append
(
"__floordiv__ called"
)
return
self
return
self
...
...
Lib/test/test_class.py
View file @
a60c2fe4
...
@@ -15,6 +15,8 @@ testmeths = [
...
@@ -15,6 +15,8 @@ testmeths = [
"rmul"
,
"rmul"
,
"truediv"
,
"truediv"
,
"rtruediv"
,
"rtruediv"
,
"floordiv"
,
"rfloordiv"
,
"mod"
,
"mod"
,
"rmod"
,
"rmod"
,
"divmod"
,
"divmod"
,
...
@@ -174,15 +176,23 @@ class ClassTests(unittest.TestCase):
...
@@ -174,15 +176,23 @@ class ClassTests(unittest.TestCase):
1
*
testme
1
*
testme
self
.
assertCallStack
([(
"__rmul__"
,
(
testme
,
1
))])
self
.
assertCallStack
([(
"__rmul__"
,
(
testme
,
1
))])
if
1
/
2
==
0
:
callLst
[:]
=
[]
callLst
[:]
=
[]
testme
/
1
testme
/
1
self
.
assertCallStack
([(
"__truediv__"
,
(
testme
,
1
))])
self
.
assertCallStack
([(
"__div__"
,
(
testme
,
1
))])
callLst
[:]
=
[]
1
/
testme
self
.
assertCallStack
([(
"__rtruediv__"
,
(
testme
,
1
))])
callLst
[:]
=
[]
callLst
[:]
=
[]
1
/
testme
testme
//
1
self
.
assertCallStack
([(
"__rdiv__"
,
(
testme
,
1
))])
self
.
assertCallStack
([(
"__floordiv__"
,
(
testme
,
1
))])
callLst
[:]
=
[]
1
//
testme
self
.
assertCallStack
([(
"__rfloordiv__"
,
(
testme
,
1
))])
callLst
[:]
=
[]
callLst
[:]
=
[]
testme
%
1
testme
%
1
...
@@ -444,12 +454,16 @@ class ClassTests(unittest.TestCase):
...
@@ -444,12 +454,16 @@ class ClassTests(unittest.TestCase):
def
__int__
(
self
):
def
__int__
(
self
):
return
None
return
None
__float__
=
__int__
__float__
=
__int__
__complex__
=
__int__
__str__
=
__int__
__str__
=
__int__
__repr__
=
__int__
__repr__
=
__int__
__oct__
=
__int__
__bytes__
=
__int__
__hex__
=
__int__
__bool__
=
__int__
__index__
=
__int__
def
index
(
x
):
return
[][
x
]
for
f
in
[
int
,
float
,
str
,
repr
,
oct
,
h
ex
]:
for
f
in
[
float
,
complex
,
str
,
repr
,
bytes
,
bin
,
oct
,
hex
,
bool
,
ind
ex
]:
self
.
assertRaises
(
TypeError
,
f
,
BadTypeClass
())
self
.
assertRaises
(
TypeError
,
f
,
BadTypeClass
())
def
testHashStuff
(
self
):
def
testHashStuff
(
self
):
...
...
Lib/test/test_descr.py
View file @
a60c2fe4
...
@@ -21,7 +21,8 @@ class OperatorsTest(unittest.TestCase):
...
@@ -21,7 +21,8 @@ class OperatorsTest(unittest.TestCase):
'add'
:
'+'
,
'add'
:
'+'
,
'sub'
:
'-'
,
'sub'
:
'-'
,
'mul'
:
'*'
,
'mul'
:
'*'
,
'div'
:
'/'
,
'truediv'
:
'/'
,
'floordiv'
:
'//'
,
'divmod'
:
'divmod'
,
'divmod'
:
'divmod'
,
'pow'
:
'**'
,
'pow'
:
'**'
,
'lshift'
:
'<<'
,
'lshift'
:
'<<'
,
...
@@ -52,8 +53,6 @@ class OperatorsTest(unittest.TestCase):
...
@@ -52,8 +53,6 @@ class OperatorsTest(unittest.TestCase):
'invert'
:
'~'
,
'invert'
:
'~'
,
'int'
:
'int'
,
'int'
:
'int'
,
'float'
:
'float'
,
'float'
:
'float'
,
'oct'
:
'oct'
,
'hex'
:
'hex'
,
}
}
for
name
,
expr
in
list
(
self
.
unops
.
items
()):
for
name
,
expr
in
list
(
self
.
unops
.
items
()):
...
@@ -82,12 +81,6 @@ class OperatorsTest(unittest.TestCase):
...
@@ -82,12 +81,6 @@ class OperatorsTest(unittest.TestCase):
def
binop_test
(
self
,
a
,
b
,
res
,
expr
=
"a+b"
,
meth
=
"__add__"
):
def
binop_test
(
self
,
a
,
b
,
res
,
expr
=
"a+b"
,
meth
=
"__add__"
):
d
=
{
'a'
:
a
,
'b'
:
b
}
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
)
self
.
assertEqual
(
eval
(
expr
,
d
),
res
)
t
=
type
(
a
)
t
=
type
(
a
)
m
=
getattr
(
t
,
meth
)
m
=
getattr
(
t
,
meth
)
...
@@ -221,7 +214,7 @@ class OperatorsTest(unittest.TestCase):
...
@@ -221,7 +214,7 @@ class OperatorsTest(unittest.TestCase):
def
number_operators
(
self
,
a
,
b
,
skip
=
[]):
def
number_operators
(
self
,
a
,
b
,
skip
=
[]):
dict
=
{
'a'
:
a
,
'b'
:
b
}
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
:
if
name
not
in
skip
:
name
=
"__%s__"
%
name
name
=
"__%s__"
%
name
if
hasattr
(
a
,
name
):
if
hasattr
(
a
,
name
):
...
@@ -261,7 +254,7 @@ class OperatorsTest(unittest.TestCase):
...
@@ -261,7 +254,7 @@ class OperatorsTest(unittest.TestCase):
# Testing complex operations...
# Testing complex operations...
self
.
number_operators
(
100.0j
,
3.0j
,
skip
=
[
'lt'
,
'le'
,
'gt'
,
'ge'
,
self
.
number_operators
(
100.0j
,
3.0j
,
skip
=
[
'lt'
,
'le'
,
'gt'
,
'ge'
,
'int'
,
'float'
,
'int'
,
'float'
,
'divmod'
,
'mod'
])
'
floordiv'
,
'
divmod'
,
'mod'
])
class
Number
(
complex
):
class
Number
(
complex
):
__slots__
=
[
'prec'
]
__slots__
=
[
'prec'
]
...
@@ -4160,9 +4153,8 @@ order (MRO) for bases """
...
@@ -4160,9 +4153,8 @@ order (MRO) for bases """
(
'__add__'
,
'x + y'
,
'x += y'
),
(
'__add__'
,
'x + y'
,
'x += y'
),
(
'__sub__'
,
'x - y'
,
'x -= y'
),
(
'__sub__'
,
'x - y'
,
'x -= y'
),
(
'__mul__'
,
'x * y'
,
'x *= y'
),
(
'__mul__'
,
'x * y'
,
'x *= y'
),
(
'__truediv__'
,
'operator.truediv(x, y)'
,
None
),
(
'__truediv__'
,
'x / y'
,
'x /= y'
),
(
'__floordiv__'
,
'operator.floordiv(x, y)'
,
None
),
(
'__floordiv__'
,
'x // y'
,
'x //= y'
),
(
'__div__'
,
'x / y'
,
'x /= y'
),
(
'__mod__'
,
'x % y'
,
'x %= y'
),
(
'__mod__'
,
'x % y'
,
'x %= y'
),
(
'__divmod__'
,
'divmod(x, y)'
,
None
),
(
'__divmod__'
,
'divmod(x, y)'
,
None
),
(
'__pow__'
,
'x ** y'
,
'x **= y'
),
(
'__pow__'
,
'x ** y'
,
'x **= y'
),
...
@@ -4224,8 +4216,8 @@ order (MRO) for bases """
...
@@ -4224,8 +4216,8 @@ order (MRO) for bases """
# Also check type_getattro for correctness.
# Also check type_getattro for correctness.
class
Meta
(
type
):
class
Meta
(
type
):
pass
pass
class
X
(
object
):
class
X
(
metaclass
=
Meta
):
__metaclass__
=
Meta
pass
X
.
a
=
42
X
.
a
=
42
Meta
.
a
=
Descr
(
"a"
)
Meta
.
a
=
Descr
(
"a"
)
self
.
assertEqual
(
X
.
a
,
42
)
self
.
assertEqual
(
X
.
a
,
42
)
...
...
Lib/test/test_dynamicclassattribute.py
View file @
a60c2fe4
...
@@ -158,9 +158,9 @@ class PropertyTests(unittest.TestCase):
...
@@ -158,9 +158,9 @@ class PropertyTests(unittest.TestCase):
# check that the DynamicClassAttribute's __isabstractmethod__ descriptor does the
# check that the DynamicClassAttribute's __isabstractmethod__ descriptor does the
# right thing when presented with a value that fails truth testing:
# right thing when presented with a value that fails truth testing:
class
NotBool
(
object
):
class
NotBool
(
object
):
def
__
nonzero
__
(
self
):
def
__
bool
__
(
self
):
raise
ValueError
()
raise
ValueError
()
__len__
=
__
nonzero
__
__len__
=
__
bool
__
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
(
ValueError
):
class
C
(
object
):
class
C
(
object
):
def
foo
(
self
):
def
foo
(
self
):
...
...
Lib/test/test_inspect.py
View file @
a60c2fe4
...
@@ -786,7 +786,7 @@ class TestClassesAndFunctions(unittest.TestCase):
...
@@ -786,7 +786,7 @@ class TestClassesAndFunctions(unittest.TestCase):
class
Meta
(
type
):
class
Meta
(
type
):
fish
=
'slap'
fish
=
'slap'
def
__dir__
(
self
):
def
__dir__
(
self
):
return
[
'__class__'
,
'__module
s
__'
,
'__name__'
,
'fish'
]
return
[
'__class__'
,
'__module__'
,
'__name__'
,
'fish'
]
class
Class
(
metaclass
=
Meta
):
class
Class
(
metaclass
=
Meta
):
pass
pass
should_find
=
inspect
.
Attribute
(
'fish'
,
'data'
,
Meta
,
'slap'
)
should_find
=
inspect
.
Attribute
(
'fish'
,
'data'
,
Meta
,
'slap'
)
...
...
Lib/test/test_itertools.py
View file @
a60c2fe4
...
@@ -698,7 +698,7 @@ class TestBasicOps(unittest.TestCase):
...
@@ -698,7 +698,7 @@ class TestBasicOps(unittest.TestCase):
# iter.__next__ failure on inner object
# iter.__next__ failure on inner object
self
.
assertRaises
(
ExpectedError
,
gulp
,
delayed_raise
(
1
))
self
.
assertRaises
(
ExpectedError
,
gulp
,
delayed_raise
(
1
))
# __
cmp
__ failure
# __
eq
__ failure
class
DummyCmp
:
class
DummyCmp
:
def
__eq__
(
self
,
dst
):
def
__eq__
(
self
,
dst
):
raise
ExpectedError
raise
ExpectedError
...
...
Lib/test/test_property.py
View file @
a60c2fe4
...
@@ -140,9 +140,9 @@ class PropertyTests(unittest.TestCase):
...
@@ -140,9 +140,9 @@ class PropertyTests(unittest.TestCase):
# check that the property's __isabstractmethod__ descriptor does the
# check that the property's __isabstractmethod__ descriptor does the
# right thing when presented with a value that fails truth testing:
# right thing when presented with a value that fails truth testing:
class
NotBool
(
object
):
class
NotBool
(
object
):
def
__
nonzero
__
(
self
):
def
__
bool
__
(
self
):
raise
ValueError
()
raise
ValueError
()
__len__
=
__
nonzero
__
__len__
=
__
bool
__
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
(
ValueError
):
class
C
(
object
):
class
C
(
object
):
def
foo
(
self
):
def
foo
(
self
):
...
...
Lib/test/test_unicode.py
View file @
a60c2fe4
...
@@ -1988,64 +1988,26 @@ class UnicodeTest(string_tests.CommonTest,
...
@@ -1988,64 +1988,26 @@ class UnicodeTest(string_tests.CommonTest,
self
.
fail
(
"Should have raised UnicodeDecodeError"
)
self
.
fail
(
"Should have raised UnicodeDecodeError"
)
def
test_conversion
(
self
):
def
test_conversion
(
self
):
# Make sure __
unicode
__() works properly
# Make sure __
str
__() works properly
class
Foo0
:
class
ObjectToStr
:
def
__str__
(
self
):
def
__str__
(
self
):
return
"foo"
return
"foo"
class
Foo1
:
class
StrSubclassToStr
(
str
)
:
def
__str__
(
self
):
def
__str__
(
self
):
return
"foo"
return
"foo"
class
Foo2
(
object
):
class
StrSubclassToStrSubclass
(
str
):
def
__str__
(
self
):
return
"foo"
class
Foo3
(
object
):
def
__str__
(
self
):
return
"foo"
class
Foo4
(
str
):
def
__str__
(
self
):
return
"foo"
class
Foo5
(
str
):
def
__str__
(
self
):
return
"foo"
class
Foo6
(
str
):
def
__str__
(
self
):
return
"foos"
def
__str__
(
self
):
return
"foou"
class
Foo7
(
str
):
def
__str__
(
self
):
return
"foos"
def
__str__
(
self
):
return
"foou"
class
Foo8
(
str
):
def
__new__
(
cls
,
content
=
""
):
def
__new__
(
cls
,
content
=
""
):
return
str
.
__new__
(
cls
,
2
*
content
)
return
str
.
__new__
(
cls
,
2
*
content
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
return
self
class
Foo9
(
str
):
self
.
assertEqual
(
str
(
ObjectToStr
()),
"foo"
)
def
__str__
(
self
):
self
.
assertEqual
(
str
(
StrSubclassToStr
(
"bar"
)),
"foo"
)
return
"not unicode"
s
=
str
(
StrSubclassToStrSubclass
(
"foo"
))
self
.
assertEqual
(
s
,
"foofoo"
)
self
.
assertEqual
(
str
(
Foo0
()),
"foo"
)
self
.
assertIs
(
type
(
s
),
StrSubclassToStrSubclass
)
self
.
assertEqual
(
str
(
Foo1
()),
"foo"
)
self
.
assertEqual
(
str
(
Foo2
()),
"foo"
)
self
.
assertEqual
(
str
(
Foo3
()),
"foo"
)
self
.
assertEqual
(
str
(
Foo4
(
"bar"
)),
"foo"
)
self
.
assertEqual
(
str
(
Foo5
(
"bar"
)),
"foo"
)
self
.
assertEqual
(
str
(
Foo6
(
"bar"
)),
"foou"
)
self
.
assertEqual
(
str
(
Foo7
(
"bar"
)),
"foou"
)
self
.
assertEqual
(
str
(
Foo8
(
"foo"
)),
"foofoo"
)
self
.
assertEqual
(
str
(
Foo9
(
"foo"
)),
"not unicode"
)
def
test_unicode_repr
(
self
):
def
test_unicode_repr
(
self
):
class
s1
:
class
s1
:
...
...
Modules/_decimal/tests/deccheck.py
View file @
a60c2fe4
...
@@ -126,7 +126,7 @@ ContextFunctions = {
...
@@ -126,7 +126,7 @@ ContextFunctions = {
# Functions that require a restricted exponent range for reasonable runtimes.
# Functions that require a restricted exponent range for reasonable runtimes.
UnaryRestricted
=
[
UnaryRestricted
=
[
'__ceil__'
,
'__floor__'
,
'__int__'
,
'__
long__'
,
'__
trunc__'
,
'__ceil__'
,
'__floor__'
,
'__int__'
,
'__trunc__'
,
'to_integral'
,
'to_integral_value'
'to_integral'
,
'to_integral_value'
]
]
...
...
Modules/mathmodule.c
View file @
a60c2fe4
...
@@ -992,7 +992,7 @@ FUNC1(tanh, tanh, 0,
...
@@ -992,7 +992,7 @@ FUNC1(tanh, tanh, 0,
Note 4: A similar implementation is in Modules/cmathmodule.c.
Note 4: A similar implementation is in Modules/cmathmodule.c.
Be sure to update both when making changes.
Be sure to update both when making changes.
Note 5: The signature of math.fsum() differs from
__builtin__
.sum()
Note 5: The signature of math.fsum() differs from
builtins
.sum()
because the start argument doesn't make sense in the context of
because the start argument doesn't make sense in the context of
accurate summation. Since the partials table is collapsed before
accurate summation. Since the partials table is collapsed before
returning a result, sum(seq2, start=sum(seq1)) may not equal the
returning a result, sum(seq2, start=sum(seq1)) may not equal the
...
...
Tools/clinic/clinic.py
View file @
a60c2fe4
...
@@ -1830,7 +1830,6 @@ __gt__
...
@@ -1830,7 +1830,6 @@ __gt__
__hash__
__hash__
__iadd__
__iadd__
__iand__
__iand__
__idivmod__
__ifloordiv__
__ifloordiv__
__ilshift__
__ilshift__
__imod__
__imod__
...
...
Tools/pynche/ColorDB.py
View file @
a60c2fe4
...
@@ -23,7 +23,6 @@ color formats, and for calculating other color values.
...
@@ -23,7 +23,6 @@ color formats, and for calculating other color values.
import
sys
import
sys
import
re
import
re
from
types
import
*
from
types
import
*
import
operator
class
BadColor
(
Exception
):
class
BadColor
(
Exception
):
pass
pass
...
@@ -230,9 +229,8 @@ def triplet_to_rrggbb(rgbtuple):
...
@@ -230,9 +229,8 @@ def triplet_to_rrggbb(rgbtuple):
return
hexname
return
hexname
_maxtuple
=
(
256.0
,)
*
3
def
triplet_to_fractional_rgb
(
rgbtuple
):
def
triplet_to_fractional_rgb
(
rgbtuple
):
return
list
(
map
(
operator
.
__div__
,
rgbtuple
,
_maxtuple
))
return
[
x
/
256
for
x
in
rgbtuple
]
def
triplet_to_brightness
(
rgbtuple
):
def
triplet_to_brightness
(
rgbtuple
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment