2015-01-31 05:46:11 +03:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2015-04-19 22:39:18 +03:00
|
|
|
|
2015-09-21 12:23:38 +03:00
|
|
|
@pytest.mark.models
|
2015-01-31 05:46:11 +03:00
|
|
|
def test_single_period(EN):
|
|
|
|
string = 'A test sentence.'
|
|
|
|
words = EN(string)
|
|
|
|
assert len(words) == 4
|
2015-03-14 18:10:42 +03:00
|
|
|
assert len(list(words.sents)) == 1
|
|
|
|
assert sum(len(sent) for sent in words.sents) == len(words)
|
2015-01-31 05:46:11 +03:00
|
|
|
|
|
|
|
|
2015-09-21 12:23:38 +03:00
|
|
|
@pytest.mark.models
|
2015-01-31 05:46:11 +03:00
|
|
|
def test_single_no_period(EN):
|
|
|
|
string = 'A test sentence'
|
|
|
|
words = EN(string)
|
|
|
|
assert len(words) == 3
|
2015-03-14 18:10:42 +03:00
|
|
|
assert len(list(words.sents)) == 1
|
|
|
|
assert sum(len(sent) for sent in words.sents) == len(words)
|
2015-01-31 05:46:11 +03:00
|
|
|
|
|
|
|
|
2015-09-21 12:23:38 +03:00
|
|
|
@pytest.mark.models
|
2015-01-31 05:46:11 +03:00
|
|
|
def test_single_exclamation(EN):
|
|
|
|
string = 'A test sentence!'
|
|
|
|
words = EN(string)
|
|
|
|
assert len(words) == 4
|
2015-03-14 18:10:42 +03:00
|
|
|
assert len(list(words.sents)) == 1
|
|
|
|
assert sum(len(sent) for sent in words.sents) == len(words)
|
2015-01-31 05:46:11 +03:00
|
|
|
|
|
|
|
|
2015-09-21 12:23:38 +03:00
|
|
|
@pytest.mark.models
|
2015-01-31 05:46:11 +03:00
|
|
|
def test_single_question(EN):
|
|
|
|
string = 'A test sentence?'
|
|
|
|
words = EN(string, tag=False, parse=False)
|
|
|
|
assert len(words) == 4
|
2015-03-14 18:10:42 +03:00
|
|
|
assert len(list(words.sents)) == 1
|
|
|
|
assert sum(len(sent) for sent in words.sents) == len(words)
|