Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use byteorder param
  • Loading branch information
sobolevn committed Oct 9, 2022
commit 3fc65b4569f7777a73689a6cea56d551a0453f2e
12 changes: 8 additions & 4 deletions Lib/test/test_long.py
Original file line number Diff line number Diff line change
Expand Up @@ -1361,10 +1361,14 @@ class RaisingBytes:
def __bytes__(self):
1 / 0

self.assertEqual(int.from_bytes(ValidBytes()), 1)
self.assertRaises(TypeError, int.from_bytes, InvalidBytes())
self.assertRaises(TypeError, int.from_bytes, MissingBytes())
self.assertRaises(ZeroDivisionError, int.from_bytes, RaisingBytes())
for byte_order in ('big', 'little'):
self.assertEqual(int.from_bytes(ValidBytes(), byte_order), 1)
self.assertRaises(
TypeError, int.from_bytes, InvalidBytes(), byte_order)
self.assertRaises(
TypeError, int.from_bytes, MissingBytes(), byte_order)
self.assertRaises(
ZeroDivisionError, int.from_bytes, RaisingBytes(), byte_order)

def test_access_to_nonexistent_digit_0(self):
# http://bugs.python.org/issue14630: A bug in _PyLong_Copy meant that
Expand Down