2014-10-14 09:25:57 +00:00
|
|
|
"""Test that tokens are created correctly for whitespace."""
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
2015-06-07 15:24:49 +00:00
|
|
|
def test_single_space(en_tokenizer):
|
|
|
|
tokens = en_tokenizer('hello possums')
|
2014-10-14 09:25:57 +00:00
|
|
|
assert len(tokens) == 2
|
|
|
|
|
|
|
|
|
2015-06-07 15:24:49 +00:00
|
|
|
def test_double_space(en_tokenizer):
|
|
|
|
tokens = en_tokenizer('hello possums')
|
2014-10-14 09:25:57 +00:00
|
|
|
assert len(tokens) == 3
|
2015-01-23 20:22:30 +00:00
|
|
|
assert tokens[1].orth_ == ' '
|
2014-10-14 09:25:57 +00:00
|
|
|
|
|
|
|
|
2015-06-07 15:24:49 +00:00
|
|
|
def test_newline(en_tokenizer):
|
|
|
|
tokens = en_tokenizer('hello\npossums')
|
2014-10-14 09:25:57 +00:00
|
|
|
assert len(tokens) == 3
|
|
|
|
|
|
|
|
|
2015-06-07 15:24:49 +00:00
|
|
|
def test_newline_space(en_tokenizer):
|
|
|
|
tokens = en_tokenizer('hello \npossums')
|
2014-10-14 09:25:57 +00:00
|
|
|
assert len(tokens) == 3
|
|
|
|
|
|
|
|
|
2015-06-07 15:24:49 +00:00
|
|
|
def test_newline_double_space(en_tokenizer):
|
|
|
|
tokens = en_tokenizer('hello \npossums')
|
2014-10-14 09:25:57 +00:00
|
|
|
assert len(tokens) == 3
|
|
|
|
|
|
|
|
|
2015-06-07 15:24:49 +00:00
|
|
|
def test_newline_space_wrap(en_tokenizer):
|
|
|
|
tokens = en_tokenizer('hello \n possums')
|
2014-10-14 09:25:57 +00:00
|
|
|
assert len(tokens) == 3
|