code: def test_wcswidth_substr():
      """
      Test wcswidth() optional 2nd parameter, ``n``.
  
      ``n`` determines at which position of the string
      to stop counting length.
      """
      # given,
      phrase = "コンニチハ, セカイ!"
      end = 7
      expect_length_each = (
          2,
          2,
          2,
          2,
          2,
          1,
          1,
      )
      expect_length_phrase = sum(expect_length_each)
  
      # exercise,
      length_each = tuple(map(wcwidth.wcwidth, phrase))[:end]
      length_phrase = wcwidth.wcswidth(phrase, end)
  
      # verify.
      assert length_each == expect_length_each
      assert length_phrase == expect_length_phrase
  
file_path: catboost/contrib/python/wcwidth/py3/tests/test_core.py
imports: import wcwidth
label_desc: Use image node_id 5 for calling a global function with example usage: test_wcswidth_substr() without return types