                  else:
                      start = i
                  in_ws = not in_ws
              i += 1
          i += 1
          if start < i:
              span = string[start:]
              key = hash_string(span)
              cache_hit = self._try_cache(key, tokens)
              if not cache_hit:
 
</s> remove     assert doc.text_with_ws == text
 </s> add     assert ''.join([token.text_with_ws for token in doc]) == text


@pytest.mark.parametrize('text', ["This is a string", "This is a string\n"])
def test_control_issue792(en_tokenizer, text):
    """Test base case for Issue #792: Non-trailing whitespace"""
    doc = en_tokenizer(text)
    assert ''.join([token.text_with_ws for token in doc]) == text </s> remove @pytest.mark.xfail
 </s> add  </s> remove     """Test for Issue #792: Trailing whitespace is removed after parsing."""
 </s> add     """Test for Issue #792: Trailing whitespace is removed after tokenization."""
                  else:
                      start = i
                  in_ws = not in_ws
              i += 1

          if start < i:
              span = string[start:]
              key = hash_string(span)
              cache_hit = self._try_cache(key, tokens)
              if not cache_hit:
keep keep keep keep replace keep keep keep keep keep
 Fix handling of trailing whitespace

Fix off-by-one error that meant trailing spaces were being dropped.
Closes #792 
spacy/tokenizer.pyx