Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses.

This commit is contained in:
Serhiy Storchaka 2016-05-12 10:37:58 +03:00
parent 9de7efe5ab
commit ea36c941a1
6 changed files with 56 additions and 21 deletions

View file

@ -314,6 +314,10 @@ class BoolTest(unittest.TestCase):
return -1
self.assertRaises(ValueError, bool, Eggs())
def test_from_bytes(self):
self.assertIs(bool.from_bytes(b'\x00'*8, 'big'), False)
self.assertIs(bool.from_bytes(b'abcd', 'little'), True)
def test_sane_len(self):
# this test just tests our assumptions about __len__
# this will start failing if __len__ changes assertions