code: def test_unpack_from(self):
      test_string = b"abcd01234"
      fmt = "4s"
      s = struct.Struct(fmt)
      for cls in (bytes, bytearray):
          data = cls(test_string)
          self.assertEqual(s.unpack_from(data), (b"abcd",))
          self.assertEqual(s.unpack_from(data, 2), (b"cd01",))
          self.assertEqual(s.unpack_from(data, 4), (b"0123",))
          for i in range(6):
              self.assertEqual(
                  s.unpack_from(data, i), (data[i : i + 4],)
              )
          for i in range(6, len(test_string) + 1):
              self.assertRaises(struct.error, s.unpack_from, data, i)
      for cls in (bytes, bytearray):
          data = cls(test_string)
          self.assertEqual(struct.unpack_from(fmt, data), (b"abcd",))
          self.assertEqual(struct.unpack_from(fmt, data, 2), (b"cd01",))
          self.assertEqual(struct.unpack_from(fmt, data, 4), (b"0123",))
          for i in range(6):
              self.assertEqual(
                  struct.unpack_from(fmt, data, i), (data[i : i + 4],)
              )
          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",)
      )
  
imports: from collections import abc
  import array
  import gc
  import math
  import operator
  import unittest
  import struct
  import sys
  import weakref
  from test import support
  from test.support import import_helper
  from test.support.script_helper import assert_python_ok
label_desc: Use image node_id 11 for calling the StructTest obj's underlying member method code with example usage: obj.test_unpack_from() without return types