code: def _testNCOLOrLGL(self, func, fname, can_be_reopened=True):
      g = func(fname, names=False, weights=False, directed=False)
      self.assertTrue(isinstance(g, Graph))
      self.assertTrue(g.vcount() == 4 and g.ecount() == 5)
      self.assertTrue(not g.is_directed())
      self.assertTrue(
          sorted(g.get_edgelist())
          == [(0, 1), (0, 2), (1, 1), (1, 3), (2, 3)]
      )
      self.assertTrue(
          "name" not in g.vertex_attributes()
          and "weight" not in g.edge_attributes()
      )
      if not can_be_reopened:
          return
  
      g = func(fname, names=False, directed=False)
      self.assertTrue(
          "name" not in g.vertex_attributes()
          and "weight" in g.edge_attributes()
      )
      self.assertTrue(g.es["weight"] == [1, 2, 0, 3, 0])
  
      g = func(fname, directed=False)
      self.assertTrue(
          "name" in g.vertex_attributes()
          and "weight" in g.edge_attributes()
      )
      self.assertTrue(g.vs["name"] == ["eggs", "spam", "ham", "bacon"])
      self.assertTrue(g.es["weight"] == [1, 2, 0, 3, 0])
  
imports: import gzip
  import io
  import unittest
  import warnings
  from igraph import Graph, InternalError
  from .utils import temporary_file
label_desc: Use image node_id 3 for calling the ForeignTests obj's underlying member method code with example usage: obj._testNCOLOrLGL(func, fname, can_be_reopened) without return types