mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Patch #1733960: Allow T_LONGLONG to accept ints.
This commit is contained in:
parent
66e64e2b6a
commit
2276885acd
6 changed files with 76 additions and 28 deletions
|
|
@ -2,7 +2,8 @@ from _testcapi import test_structmembersType, \
|
|||
CHAR_MAX, CHAR_MIN, UCHAR_MAX, \
|
||||
SHRT_MAX, SHRT_MIN, USHRT_MAX, \
|
||||
INT_MAX, INT_MIN, UINT_MAX, \
|
||||
LONG_MAX, LONG_MIN, ULONG_MAX
|
||||
LONG_MAX, LONG_MIN, ULONG_MAX, \
|
||||
LLONG_MAX, LLONG_MIN, ULLONG_MAX
|
||||
|
||||
import warnings, exceptions, unittest, test.test_warnings
|
||||
from test import test_support
|
||||
|
|
@ -39,6 +40,24 @@ class ReadWriteTests(unittest.TestCase):
|
|||
ts.T_ULONG=ULONG_MAX
|
||||
self.assertEquals(ts.T_ULONG, ULONG_MAX)
|
||||
|
||||
## T_LONGLONG and T_ULONGLONG may not be present on some platforms
|
||||
if hasattr(ts, 'T_LONGLONG'):
|
||||
ts.T_LONGLONG=LLONG_MAX
|
||||
self.assertEquals(ts.T_LONGLONG, LLONG_MAX)
|
||||
ts.T_LONGLONG=LLONG_MIN
|
||||
self.assertEquals(ts.T_LONGLONG, LLONG_MIN)
|
||||
|
||||
ts.T_ULONGLONG=ULLONG_MAX
|
||||
self.assertEquals(ts.T_ULONGLONG, ULLONG_MAX)
|
||||
|
||||
## make sure these will accept a plain int as well as a long
|
||||
ts.T_LONGLONG=3
|
||||
self.assertEquals(ts.T_LONGLONG, 3)
|
||||
ts.T_ULONGLONG=4
|
||||
self.assertEquals(ts.T_ULONGLONG, 4)
|
||||
|
||||
|
||||
|
||||
def test_main(verbose=None):
|
||||
test_support.run_unittest(
|
||||
ReadWriteTests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue