code: def test_add_to_existing_file(self):
      materialized_reports = [
          [
              subnetwork.MaterializedReport(
                  iteration_number=0,
                  name="foo1",
                  hparams={
                      "p1": 11,
                      "p2": "default_hparam",
                      "p3": b"binary_hparam",
                      "p4": "unicode_hparam",
                      "p5": True,
                  },
                  attributes={
                      "a1": 11,
                      "a2": "default_attribute",
                      "a3": b"binary_attribute",
                      "a4": "unicode_attribute",
                      "a5": True,
                  },
                  metrics={
                      "m1": 11,
                      "m2": "default_metric",
                      "m3": b"binary_metric",
                      "m4": "unicode_metric",
                      "m5": True,
                  },
                  included_in_final_ensemble=False,
              ),
              subnetwork.MaterializedReport(
                  iteration_number=0,
                  name="foo2",
                  hparams={
                      "p1": 12,
                      "p2": "default_hparam",
                      "p3": b"binary_hparam",
                      "p4": "unicode_hparam",
                      "p5": True,
                  },
                  attributes={
                      "a1": 12,
                      "a2": "default_attribute",
                      "a3": b"binary_attribute",
                      "a4": "unicode_attribute",
                      "a5": True,
                  },
                  metrics={
                      "m1": 12,
                      "m2": "default_metric",
                      "m3": b"binary_metric",
                      "m4": "unicode_metric",
                      "m5": True,
                  },
                  included_in_final_ensemble=True,
              ),
          ],
          [
              subnetwork.MaterializedReport(
                  iteration_number=1,
                  name="foo1",
                  hparams={
                      "p1": 21,
                      "p2": "default_hparam",
                      "p3": b"binary_hparam",
                      "p4": "unicode_hparam",
                      "p5": True,
                  },
                  attributes={
                      "a1": 21,
                      "a2": "default_attribute",
                      "a3": b"binary_attribute",
                      "a4": "unicode_attribute",
                      "a5": True,
                  },
                  metrics={
                      "m1": 21,
                      "m2": "default_metric",
                      "m3": b"binary_metric",
                      "m4": "unicode_metric",
                      "m5": True,
                  },
                  included_in_final_ensemble=True,
              ),
              subnetwork.MaterializedReport(
                  iteration_number=1,
                  name="foo2",
                  hparams={
                      "p1": 22,
                      "p2": "default_hparam",
                      "p3": b"binary_hparam",
                      "p4": "unicode_hparam",
                      "p5": True,
                  },
                  attributes={
                      "a1": 22,
                      "a2": "default_attribute",
                      "a3": b"binary_attribute",
                      "a4": "unicode_attribute",
                      "a5": True,
                  },
                  metrics={
                      "m1": 22,
                      "m2": "default_metric",
                      "m3": b"binary_metric",
                      "m4": "unicode_metric",
                      "m5": True,
                  },
                  included_in_final_ensemble=False,
              ),
          ],
          [
              subnetwork.MaterializedReport(
                  iteration_number=2,
                  name="foo1",
                  hparams={
                      "p1": 31,
                      "p2": "default_hparam",
                      "p3": b"binary_hparam",
                      "p4": "unicode_hparam",
                      "p5": True,
                  },
                  attributes={
                      "a1": 31,
                      "a2": "default_attribute",
                      "a3": b"binary_attribute",
                      "a4": "unicode_attribute",
                      "a5": True,
                  },
                  metrics={
                      "m1": 31,
                      "m2": "default_metric",
                      "m3": b"binary_metric",
                      "m4": "unicode_metric",
                      "m5": True,
                  },
                  included_in_final_ensemble=False,
              ),
              subnetwork.MaterializedReport(
                  iteration_number=2,
                  name="foo2",
                  hparams={
                      "p1": 32,
                      "p2": "default_hparam",
                      "p3": b"binary_hparam",
                      "p4": "unicode_hparam",
                      "p5": True,
                  },
                  attributes={
                      "a1": 32,
                      "a2": "default_attribute",
                      "a3": b"binary_attribute",
                      "a4": "unicode_attribute",
                      "a5": True,
                  },
                  metrics={
                      "m1": 32,
                      "m2": "default_metric",
                      "m3": b"binary_metric",
                      "m4": "unicode_metric",
                      "m5": True,
                  },
                  included_in_final_ensemble=True,
              ),
          ],
      ]
  
      report_accessor = _ReportAccessor(self.get_temp_dir())
  
      report_accessor.write_iteration_report(0, materialized_reports[0])
      report_accessor.write_iteration_report(1, materialized_reports[1])
      report_accessor.write_iteration_report(2, materialized_reports[2])
      actual_reports = list(report_accessor.read_iteration_reports())
      self.assertEqual(materialized_reports, actual_reports)
  
file_path: adanet/adanet/core/report_accessor_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  from adanet import subnetwork
  from adanet.core.report_accessor import _ReportAccessor
  import tensorflow.compat.v2
label_desc: Use image node_id 3 for calling the ReportAccessorTest obj's underlying member method code with example usage: obj.test_add_to_existing_file() without return types