[Python-checkins] cpython (3.5): Issue #29300: test_struct tests unpack_from() with keywords

victor.stinner python-checkins at python.org
Thu Feb 2 08:19:47 EST 2017


https://hg.python.org/cpython/rev/32380d41e788
changeset:   106383:32380d41e788
branch:      3.5
parent:      106368:e4f6874abda6
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Feb 02 14:18:18 2017 +0100
summary:
  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.

files:
  Lib/test/test_struct.py |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -428,6 +428,10 @@
             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)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list