-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Description
There are some cases inside tests when old-style classes are used together with new-style classes.
I think these cases should be removed, because there are no old-style classes anymore and we just have useless logic duplication in tests.
I've found several cases:
-
cpython/Lib/test/test_descr.py
Lines 3264 to 3265 in 57be545
class OldClass: __doc__ = DocDescr() - (it is actually duplicated after
cpython/Lib/test/test_unicode.py
Lines 2379 to 2385 in 57be545
class s1: def __repr__(self): return '\\n' class s2: def __repr__(self): return '\\n' uprefix removal, but is very similar and should also be removed) -
cpython/Lib/test/pydocfodder.py
Lines 83 to 120 in 57be545
class A_new(object): "A new-style class." def A_method(self): "Method defined in A." def AB_method(self): "Method defined in A and B." def AC_method(self): "Method defined in A and C." def AD_method(self): "Method defined in A and D." def ABC_method(self): "Method defined in A, B and C." def ABD_method(self): "Method defined in A, B and D." def ACD_method(self): "Method defined in A, C and D." def ABCD_method(self): "Method defined in A, B, C and D." def A_classmethod(cls, x): "A class method defined in A." A_classmethod = classmethod(A_classmethod) def A_staticmethod(): "A static method defined in A." A_staticmethod = staticmethod(A_staticmethod) def _getx(self): "A property getter function." def _setx(self, value): "A property setter function." def _delx(self): "A property deleter function." A_property = property(fdel=_delx, fget=_getx, fset=_setx, doc="A sample property defined in A.") A_int_alias = int -
Lines 91 to 103 in 57be545
class Classic: pass class NewStyle(object): pass def f(): pass class WithMetaclass(metaclass=abc.ABCMeta): pass tests = [None, ..., NotImplemented, 42, 2**100, 3.14, True, False, 1j, "hello", "hello\u1234", f.__code__, b"world", bytes(range(256)), range(10), slice(1, 10, 2), NewStyle, Classic, max, WithMetaclass, property()] -
Lines 353 to 361 in 57be545
class Classic: pass class NewStyle(object): pass def f(): pass tests = [None, 42, 2**100, 3.14, True, False, 1j, "hello", "hello\u1234", f.__code__, NewStyle, range(10), Classic, max, property()] -
Lines 546 to 547 in 57be545
# boom__new and boom2_new are exactly like boom and boom2, except use # new-style classes. - (we should probably keep this one, because it tests more complex mechanics than one class possibly can)
cpython/Lib/test/dtracedata/instance.py
Lines 3 to 6 in 57be545
class old_style_class(): pass class new_style_class(object): pass
I will send a PR.