From a5917d1d1584bb9f7affec5a5d66bb2d24d7623e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 2 Feb 2017 14:18:18 +0100 Subject: 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. --- Lib/test/test_struct.py | 4 ++++ 1 file changed, 4 insertions(+) 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) -- cgit v0.12