mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +03:00
39 lines
779 B
Python
39 lines
779 B
Python
"""Test that tokens are created correctly for whitespace."""
|
|
from __future__ import unicode_literals
|
|
|
|
from spacy.en import EN
|
|
import pytest
|
|
|
|
|
|
def test_single_space():
|
|
tokens = EN.tokenize('hello possums')
|
|
assert len(tokens) == 2
|
|
|
|
|
|
def test_double_space():
|
|
tokens = EN.tokenize('hello possums')
|
|
assert len(tokens) == 3
|
|
assert tokens[1].string == ' '
|
|
|
|
|
|
def test_newline():
|
|
tokens = EN.tokenize('hello\npossums')
|
|
assert len(tokens) == 3
|
|
|
|
|
|
def test_newline_space():
|
|
tokens = EN.tokenize('hello \npossums')
|
|
assert len(tokens) == 3
|
|
|
|
|
|
def test_newline_double_space():
|
|
tokens = EN.tokenize('hello \npossums')
|
|
assert len(tokens) == 3
|
|
|
|
|
|
def test_newline_space_wrap():
|
|
tokens = EN.tokenize('hello \n possums')
|
|
assert len(tokens) == 3
|
|
|
|
|