code: def test_truncate_wordpieces(wordpieces, max_length, mask_from_end):
      truncated = _truncate_tokens(wordpieces, mask_from_end)
      for i, seq in enumerate(truncated.strings):
          assert len(seq) <= max_length
          assert seq == wordpieces.strings[i][:max_length]
          assert truncated.input_ids[i].shape[0] <= max_length
          assert truncated.token_type_ids[i].shape[0] <= max_length
          assert truncated.attention_mask[i].shape[0] <= max_length
  
file_path: spacy-transformers/spacy_transformers/tests/test_truncation.py
imports: import pytest
  import numpy
  from thinc.types import Ragged
  from thinc.api import NumpyOps
  from ..data_classes import WordpieceBatch
  from ..truncate import _truncate_tokens, _truncate_alignment
label_desc: Use image node_id 8 for calling a global function with example usage: test_truncate_wordpieces(wordpieces, max_length, mask_from_end) without return types