Commit 77970aa5 authored by Stefan Behnel's avatar Stefan Behnel

extend fastcall test

parent 5e221d78
...@@ -5,6 +5,8 @@ import sys ...@@ -5,6 +5,8 @@ import sys
import struct import struct
from collections import deque from collections import deque
pack = struct.pack
def deque_methods(v): def deque_methods(v):
""" """
...@@ -16,6 +18,7 @@ def deque_methods(v): ...@@ -16,6 +18,7 @@ def deque_methods(v):
if sys.version_info >= (3, 5): if sys.version_info >= (3, 5):
d.insert(1, v) d.insert(1, v)
else: else:
# deque has no 2-args methods in older Python versions
d.rotate(-1) d.rotate(-1)
d.appendleft(2) d.appendleft(2)
d.rotate(1) d.rotate(1)
...@@ -30,13 +33,20 @@ def deque_methods(v): ...@@ -30,13 +33,20 @@ def deque_methods(v):
def struct_methods(v): def struct_methods(v):
""" """
>>> i, lf = struct_methods(2) >>> i, lf, i2, f = struct_methods(2)
>>> struct.unpack('i', i) >>> struct.unpack('i', i)
(2,) (2,)
>>> struct.unpack('i', i2)
(2,)
>>> struct.unpack('lf', lf) >>> struct.unpack('lf', lf)
(2, 4.0) (2, 4.0)
>>> struct.unpack('f', f)
(2.0,)
""" """
local_pack = pack
return [ return [
struct.pack('i', v), struct.pack('i', v),
struct.pack('lf', v, v*2), struct.pack('lf', v, v*2),
pack('i', v),
local_pack('f', v),
] ]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment