summaryrefslogtreecommitdiff
path: root/Lib/test/test_long.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r--Lib/test/test_long.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 1de75bf86c..e15bf8b418 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -1117,9 +1117,18 @@ class LongTest(unittest.TestCase):
expected)
except Exception as err:
raise AssertionError(
- "failed to convert {0} with byteorder={1} and signed={2}"
+ "failed to convert {} with byteorder={} and signed={}"
.format(test, byteorder, signed)) from err
+ # Test for all default arguments.
+ if len(expected) == 1 and byteorder == 'big' and not signed:
+ try:
+ self.assertEqual(test.to_bytes(), expected)
+ except Exception as err:
+ raise AssertionError(
+ "failed to convert {} with default arguments"
+ .format(test)) from err
+
try:
self.assertEqual(
equivalent_python(
@@ -1240,9 +1249,20 @@ class LongTest(unittest.TestCase):
expected)
except Exception as err:
raise AssertionError(
- "failed to convert {0} with byteorder={1!r} and signed={2}"
+ "failed to convert {} with byteorder={!r} and signed={}"
.format(test, byteorder, signed)) from err
+ # Test for all default arguments.
+ if byteorder == 'big' and not signed:
+ try:
+ self.assertEqual(
+ int.from_bytes(test),
+ expected)
+ except Exception as err:
+ raise AssertionError(
+ "failed to convert {} with default arugments"
+ .format(test)) from err
+
try:
self.assertEqual(
equivalent_python(test, byteorder, signed=signed),