summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_array.py
diff options
context:
space:
mode:
authorMeador Inge <meadori@gmail.com>2011-09-21 00:55:51 (GMT)
committerMeador Inge <meadori@gmail.com>2011-09-21 00:55:51 (GMT)
commit1c9f0c93ad26033aed79677fa0504af5a3cf0bbf (patch)
tree4fe6a5731001f84dec30ac34850459d24fa0a0fc /Lib/test/test_array.py
parent4ad6ed7d4dd79bed50b8f4d0bdbfa7af161e7294 (diff)
downloadcpython-1c9f0c93ad26033aed79677fa0504af5a3cf0bbf.zip
cpython-1c9f0c93ad26033aed79677fa0504af5a3cf0bbf.tar.gz
cpython-1c9f0c93ad26033aed79677fa0504af5a3cf0bbf.tar.bz2
Issue #1172711: Add 'long long' support to the array module.
Initial patch by Oren Tirosh and Hirokazu Yamamoto.
Diffstat (limited to 'Lib/test/test_array.py')
-rwxr-xr-xLib/test/test_array.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 5190c35..604dcdf 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -16,6 +16,13 @@ import warnings
import array
from array import _array_reconstructor as array_reconstructor
+try:
+ # Try to determine availability of long long independently
+ # of the array module under test
+ struct.calcsize('@q')
+ have_long_long = True
+except struct.error:
+ have_long_long = False
class ArraySubclass(array.array):
pass
@@ -26,6 +33,8 @@ class ArraySubclassWithKwargs(array.array):
tests = [] # list to accumulate all tests
typecodes = "ubBhHiIlLfd"
+if have_long_long:
+ typecodes += 'qQ'
class BadConstructorTest(unittest.TestCase):
@@ -1205,6 +1214,18 @@ class UnsignedLongTest(UnsignedNumberTest):
minitemsize = 4
tests.append(UnsignedLongTest)
+@unittest.skipIf(not have_long_long, 'need long long support')
+class LongLongTest(SignedNumberTest):
+ typecode = 'q'
+ minitemsize = 8
+tests.append(LongLongTest)
+
+@unittest.skipIf(not have_long_long, 'need long long support')
+class UnsignedLongLongTest(UnsignedNumberTest):
+ typecode = 'Q'
+ minitemsize = 8
+tests.append(UnsignedLongLongTest)
+
class FPTest(NumberTest):
example = [-42.0, 0, 42, 1e5, -1e10]
smallerexample = [-42.0, 0, 42, 1e5, -2e10]