code: def test_segment_and_write_all_articles(self):
      tmpf = get_tmpfile("script.tst.json")
      segment_and_write_all_articles(
          self.fname, tmpf, workers=1, include_interlinks=True
      )
  
      # Get the first line from the text file we created.
      with open(tmpf) as f:
          first = next(f)
  
      # decode JSON line into a Python dictionary object
      article = json.loads(first)
      title, section_titles, interlinks = (
          article["title"],
          article["section_titles"],
          article["interlinks"],
      )
  
      self.assertEqual(title, self.expected_title)
      self.assertEqual(section_titles, self.expected_section_titles)
  
      # Check interlinks
      # JSON has no tuples, only lists. So, we convert lists to tuples explicitly before comparison.
      self.assertEqual(len(interlinks), 685)
      self.assertEqual(
          tuple(interlinks[0]),
          ("political philosophy", "political philosophy"),
      )
      self.assertEqual(
          tuple(interlinks[1]), ("self-governance", "self-governed")
      )
      self.assertEqual(
          tuple(interlinks[2]),
          ("stateless society", "stateless societies"),
      )
  
imports: from __future__ import unicode_literals
  import json
  import logging
  import os.path
  import unittest
  import numpy
  from gensim import utils
  from gensim.scripts.segment_wiki import segment_all_articles, segment_and_write_all_articles
  from gensim.test.utils import datapath, get_tmpfile
  from gensim.scripts.word2vec2tensor import word2vec2tensor
  from gensim.models import KeyedVectors
label_desc: Use image node_id 6 for calling the TestSegmentWiki obj's underlying member method code with example usage: obj.test_segment_and_write_all_articles() without return types