code: def testSBM(self):
      pref_matrix = [[0.5, 0, 0], [0, 0, 0.5], [0, 0.5, 0]]
      n = 60
      types = [20, 20, 20]
      g = Graph.SBM(n, pref_matrix, types)
  
      # Simple smoke tests for the expected structure of the graph
      self.assertTrue(g.is_simple())
      self.assertFalse(g.is_directed())
      self.assertEqual(
          [0] * 20 + [1] * 40, g.connected_components().membership
      )
      g2 = g.subgraph(list(range(20, 60)))
      self.assertTrue(
          not any(e.source // 20 == e.target // 20 for e in g2.es)
      )
  
      # Check loops argument
      g = Graph.SBM(n, pref_matrix, types, loops=True)
      self.assertFalse(g.is_simple())
      self.assertTrue(sum(g.is_loop()) > 0)
  
      # Check directedness
      g = Graph.SBM(n, pref_matrix, types, directed=True)
      self.assertTrue(g.is_directed())
      self.assertTrue(sum(g.is_mutual()) < g.ecount())
      self.assertTrue(sum(g.is_loop()) == 0)
  
      # Check error conditions
      self.assertRaises(ValueError, Graph.SBM, -1, pref_matrix, types)
      self.assertRaises(
          InternalError, Graph.SBM, 61, pref_matrix, types
      )
      pref_matrix[0][1] = 0.7
      self.assertRaises(
          InternalError, Graph.SBM, 60, pref_matrix, types
      )
  
imports: import unittest
  from igraph import Graph, InternalError
label_desc: Use image node_id 12 for calling the GeneratorTests obj's underlying member method code with example usage: obj.testSBM() without return types