code: def test_write_readonly_file(self):
      with dbm.ndbm.open(self.filename, "c") as db:
          db[b"bytes key"] = b"bytes value"
      with dbm.ndbm.open(self.filename, "r") as db:
          with self.assertRaises(error):
              del db[b"not exist key"]
          with self.assertRaises(error):
              del db[b"bytes key"]
          with self.assertRaises(error):
              db[b"not exist key"] = b"not exist value"
  
imports: from test.support import import_helper
  from test.support import os_helper
  import os
  import unittest
  import dbm.ndbm
  from dbm.ndbm import error
label_desc: Use image node_id 9 for calling the DbmTestCase obj's underlying member method code with example usage: obj.test_write_readonly_file() without return types