summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-02-02 14:18:18 +0100
committerVictor Stinner <victor.stinner@gmail.com>2017-02-02 14:18:18 +0100
commit589bb606fa41d3ab42d65f3fe8d94c86a8870d33 (patch)
tree51b82adbeaaff704b56ba71bd0648fc5a0c494eb
parent1966772d17f49c740be143d9d4622be13e850f15 (diff)
downloadcpython-589bb606fa41d3ab42d65f3fe8d94c86a8870d33.tar.gz
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.
-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 efbdbfcc58..9b8178f84a 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)