Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a5917d1

Browse files
committed
Issue python#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.
1 parent d5adb63 commit a5917d1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/test/test_struct.py

+4
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ def test_unpack_from(self):
428428
for i in range(6, len(test_string) + 1):
429429
self.assertRaises(struct.error, struct.unpack_from, fmt, data, i)
430430

431+
# keyword arguments
432+
self.assertEqual(s.unpack_from(buffer=test_string, offset=2),
433+
(b'cd01',))
434+
431435
def test_pack_into(self):
432436
test_string = b'Reykjavik rocks, eow!'
433437
writable_buf = array.array('b', b' '*100)

0 commit comments

Comments
 (0)