code: def testTruncateOnWindows(self):
      # SF bug <https://bugs.python.org/issue801631>
      # "file.truncate fault on windows"
  
      f = self.open(TESTFN, "wb")
  
      try:
          f.write(b"12345678901")  # 11 bytes
          f.close()
  
          f = self.open(TESTFN, "rb+")
          data = f.read(5)
          if data != b"12345":
              self.fail(
                  "Read on file opened for update failed %r" % data
              )
          if f.tell() != 5:
              self.fail("File pos after read wrong %d" % f.tell())
  
          f.truncate()
          if f.tell() != 5:
              self.fail("File pos after ftruncate wrong %d" % f.tell())
  
          f.close()
          size = os.path.getsize(TESTFN)
          if size != 5:
              self.fail("File size after ftruncate wrong %d" % size)
      finally:
          f.close()
  
imports: import sys
  import os
  import unittest
  from array import array
  from weakref import proxy
  import io
  import _pyio
  from test.support import gc_collect
  from test.support.os_helper import TESTFN
  from test.support import os_helper
  from test.support import warnings_helper
  from collections import UserList
label_desc: Use image node_id 7 for calling the OtherFileTests obj's underlying member method code with example usage: obj.testTruncateOnWindows() without return types