code: def test_segmented_ttr(ttr_doc, variant, segment_size, exp_val):
      obs_val = diversity.segmented_ttr(
          ttr_doc, segment_size=segment_size, variant=variant
      )
      assert obs_val == pytest.approx(exp_val, rel=1e-2)
  
file_path: textacy/tests/text_stats/test_diversity.py
imports: import pytest
  import textacy
  from textacy.text_stats import diversity
label_desc: Use image node_id 5 for calling a global function with example usage: test_segmented_ttr(ttr_doc, variant, segment_size, exp_val) without return types