code: def test_incrementalencoder_final(self):
      encoder = codecs.getincrementalencoder(self.encoding)()
      last_index = len(self.text) - 1
      output = b"".join(
          encoder.encode(char, index == last_index)
          for index, char in enumerate(self.text)
      )
      self.assertEqual(output, self.expected_reset)
      self.assertEqual(encoder.encode("", final=True), b"")
  
imports: import _multibytecodec
  import codecs
  import io
  import sys
  import textwrap
  import unittest
  from test import support
  from test.support import os_helper
  from test.support.os_helper import TESTFN
label_desc: Use image node_id 3 for calling the TestStateful obj's underlying member method code with example usage: obj.test_incrementalencoder_final() without return types