summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-02-02 13:18:18 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-02-02 13:18:18 (GMT)
commita5917d1d1584bb9f7affec5a5d66bb2d24d7623e (patch)
treedc8df636436501736408a29e5d689dbf57049fbf /Lib
parentd5adb63673de2dea890615f75cf1a1305c3bdea1 (diff)
downloadcpython-a5917d1d1584bb9f7affec5a5d66bb2d24d7623e.zip
cpython-a5917d1d1584bb9f7affec5a5d66bb2d24d7623e.tar.gz
cpython-a5917d1d1584bb9f7affec5a5d66bb2d24d7623e.tar.bz2
Issue #29300: test_struct tests unpack_from() with keywords
Add an unit test on the _struct.Struct.unpack_from() method to test passing arguments as keywords.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_struct.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index efbdbfc..9b8178f 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -428,6 +428,10 @@ class StructTest(unittest.TestCase):
for i in range(6, len(test_string) + 1):
self.assertRaises(struct.error, struct.unpack_from, fmt, data, i)
+ # keyword arguments
+ self.assertEqual(s.unpack_from(buffer=test_string, offset=2),
+ (b'cd01',))
+
def test_pack_into(self):
test_string = b'Reykjavik rocks, eow!'
writable_buf = array.array('b', b' '*100)