Skip to content

Commit 824acf6

Browse files
committed
Merge branch 'v0.13.x' of https://github.com/PythonCharmers/python-future into v0.13.x
2 parents bceeee5 + 205a19c commit 824acf6

File tree

17 files changed

+195
-95
lines changed

17 files changed

+195
-95
lines changed

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _whats-old:
2+
13
Changes in previous versions
24
****************************
35

docs/whatsnew.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,7 @@ Bug fixes
4646
(Thanks to @str4d).
4747

4848

49+
Previous versions
50+
-----------------
4951

52+
See the :ref:`whats-old` for versions prior to v0.13.

future/tests/test_bytes.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,33 @@ def test_mod(self):
600600
with self.assertRaises(TypeError):
601601
bytes(b'%r' % 'abc')
602602

603+
@expectedFailurePY2
604+
def test_multiple_inheritance(self):
605+
"""
606+
Issue #96 (for newbytes instead of newobject)
607+
"""
608+
import collections
609+
610+
class Base(bytes):
611+
pass
612+
613+
class Foo(Base, collections.Container):
614+
def __contains__(self, item):
615+
return False
616+
617+
@expectedFailurePY2
618+
def test_with_metaclass_and_bytes(self):
619+
"""
620+
Issue #91 (for newdict instead of newobject)
621+
"""
622+
from future.utils import with_metaclass
623+
624+
class MetaClass(type):
625+
pass
626+
627+
class TestClass(with_metaclass(MetaClass, bytes)):
628+
pass
629+
603630

604631
if __name__ == '__main__':
605632
unittest.main()

future/tests/test_dict.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,34 @@ def test_braces_create_newdict_object(self):
106106
d = self.d1
107107
self.assertTrue(type(d) == dict)
108108

109+
@expectedFailurePY2
110+
def test_multiple_inheritance(self):
111+
"""
112+
Issue #96 (for newdict instead of newobject)
113+
"""
114+
import collections
115+
116+
class Base(dict):
117+
pass
118+
119+
class Foo(Base, collections.Container):
120+
def __contains__(self, item):
121+
return False
122+
123+
@expectedFailurePY2
124+
def test_with_metaclass_and_dict(self):
125+
"""
126+
Issue #91 (for newdict instead of newobject)
127+
"""
128+
from future.utils import with_metaclass
129+
130+
class MetaClass(type):
131+
pass
132+
133+
class TestClass(with_metaclass(MetaClass, dict)):
134+
pass
135+
136+
109137

110138
if __name__ == '__main__':
111139
unittest.main()

future/tests/test_int.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,33 @@ class myint(int):
10381038
self.assertRaises(TypeError, myint.from_bytes, mytype(0), 'big')
10391039
# self.assertRaises(TypeError, int.from_bytes, mytype(0), 'big', True)
10401040

1041+
@expectedFailurePY2
1042+
def test_multiple_inheritance(self):
1043+
"""
1044+
Issue #96 (for newint instead of newobject)
1045+
"""
1046+
import collections
1047+
1048+
class Base(int):
1049+
pass
1050+
1051+
class Foo(Base, collections.Container):
1052+
def __add__(self, other):
1053+
return 0
1054+
1055+
@expectedFailurePY2
1056+
def test_with_metaclass_and_int(self):
1057+
"""
1058+
Issue #91 (for newint instead of newobject)
1059+
"""
1060+
from future.utils import with_metaclass
1061+
1062+
class MetaClass(type):
1063+
pass
1064+
1065+
class TestClass(with_metaclass(MetaClass, int)):
1066+
pass
1067+
10411068

10421069
if __name__ == "__main__":
10431070
unittest.main()

future/tests/test_list.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import absolute_import, unicode_literals, print_function
77
from future.builtins import *
88
from future import utils
9-
from future.tests.base import unittest
9+
from future.tests.base import unittest, expectedFailurePY2
1010

1111

1212
class TestList(unittest.TestCase):
@@ -157,6 +157,33 @@ def test_bool(self):
157157
l2.clear()
158158
self.assertFalse(bool(l2))
159159

160+
@expectedFailurePY2
161+
def test_multiple_inheritance(self):
162+
"""
163+
Issue #96 (for newdict instead of newobject)
164+
"""
165+
import collections
166+
167+
class Base(list):
168+
pass
169+
170+
class Foo(Base, collections.Container):
171+
def __contains__(self, item):
172+
return False
173+
174+
@expectedFailurePY2
175+
def test_with_metaclass_and_list(self):
176+
"""
177+
Issue #91 (for newdict instead of newobject)
178+
"""
179+
from future.utils import with_metaclass
180+
181+
class MetaClass(type):
182+
pass
183+
184+
class TestClass(with_metaclass(MetaClass, list)):
185+
pass
186+
160187

161188
if __name__ == '__main__':
162189
unittest.main()

future/tests/test_object.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from future import utils
88
from future.builtins import object, str, next, int, super
99
from future.utils import implements_iterator, python_2_unicode_compatible
10-
from future.tests.base import unittest
10+
from future.tests.base import unittest, expectedFailurePY2
1111

1212

1313
class TestNewObject(unittest.TestCase):
@@ -162,6 +162,7 @@ class C(A):
162162
self.assertFalse(isinstance(b, C))
163163
self.assertTrue(isinstance(c, C))
164164

165+
@expectedFailurePY2
165166
def test_types_isinstance_newobject(self):
166167
a = list()
167168
b = dict()
@@ -204,6 +205,31 @@ def __int__(self):
204205
if utils.PY2:
205206
self.assertEqual(long(a), 0)
206207

208+
def test_multiple_inheritance(self):
209+
"""
210+
Issue #96
211+
"""
212+
import collections
213+
214+
class Base(object):
215+
pass
216+
217+
class Foo(Base, collections.Container):
218+
def __contains__(self, item):
219+
return False
220+
221+
def test_with_metaclass_and_object(self):
222+
"""
223+
Issue #91
224+
"""
225+
from future.utils import with_metaclass
226+
227+
class MetaClass(type):
228+
pass
229+
230+
class TestClass(with_metaclass(MetaClass, object)):
231+
pass
232+
207233

208234
if __name__ == '__main__':
209235
unittest.main()

future/tests/test_str.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import absolute_import, unicode_literals, print_function
77
from future.builtins import *
88
from future import utils
9-
from future.tests.base import unittest
9+
from future.tests.base import unittest, expectedFailurePY2
1010

1111
import os
1212

@@ -524,6 +524,33 @@ def test_maketrans_translate(self):
524524
self.assertRaises(TypeError, 'hello'.translate)
525525
self.assertRaises(TypeError, 'abababc'.translate, 'abc', 'xyz')
526526

527+
@expectedFailurePY2
528+
def test_multiple_inheritance(self):
529+
"""
530+
Issue #96 (for newstr instead of newobject)
531+
"""
532+
import collections
533+
534+
class Base(str):
535+
pass
536+
537+
class Foo(Base, collections.Container):
538+
def __contains__(self, item):
539+
return False
540+
541+
@expectedFailurePY2
542+
def test_with_metaclass_and_str(self):
543+
"""
544+
Issue #91 (for newstr instead of newobject)
545+
"""
546+
from future.utils import with_metaclass
547+
548+
class MetaClass(type):
549+
pass
550+
551+
class TestClass(with_metaclass(MetaClass, str)):
552+
pass
553+
527554

528555
if __name__ == '__main__':
529556
unittest.main()

future/types/newbytes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from future.utils import istext, isbytes, PY3, with_metaclass
1313
from future.types import no, issubset
14-
from future.types.newobject import newobject, BaseNewObject
14+
from future.types.newobject import newobject
1515

1616

1717
_builtin_bytes = bytes
@@ -21,7 +21,7 @@
2121
unicode = str
2222

2323

24-
class BaseNewBytes(BaseNewObject):
24+
class BaseNewBytes(type):
2525
def __instancecheck__(cls, instance):
2626
if cls == newbytes:
2727
return isinstance(instance, _builtin_bytes)

future/types/newdict.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
import sys
2020

2121
from future.utils import with_metaclass
22-
from future.types.newobject import newobject, BaseNewObject
22+
from future.types.newobject import newobject
2323

2424

2525
_builtin_dict = dict
2626
ver = sys.version_info[:2]
2727

2828

29-
class BaseNewDict(BaseNewObject):
29+
class BaseNewDict(type):
3030
def __instancecheck__(cls, instance):
3131
if cls == newdict:
3232
return isinstance(instance, _builtin_dict)

0 commit comments

Comments
 (0)