class_docstr: Unit tests for writing a graph to a file in graph6 format.
class_docstr_tok: ["Unit","tests","for","writing","a","graph","to","a","file","in","graph6","format","."]
code: def test_length(self):
      for i in list(range(13)) + [31, 47, 62, 63, 64, 72]:
          g = nx.random_graphs.gnm_random_graph(i, i * i // 4, seed=i)
          gstr = BytesIO()
          nx.write_graph6(g, gstr, header=False)
          # Strip the trailing newline.
          gstr = gstr.getvalue().rstrip()
          assert len(gstr) == ((i - 1) * i // 2 + 5) // 6 + (
              1 if i < 63 else 4
          )
  
imports: from io import BytesIO
  import pytest
  import networkx
  import networkx.readwrite.graph6
  from networkx.utils import edges_equal, nodes_equal
label_desc: Use image node_id 8 for calling the TestWriteGraph6 obj's underlying member method code with example usage: obj.test_length() without return types