2017-11-11 03:11:27 +03:00
|
|
|
# coding: utf8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2017-11-14 17:45:50 +03:00
|
|
|
import gc
|
|
|
|
|
2017-11-11 03:11:27 +03:00
|
|
|
from ...lang.en import English
|
|
|
|
|
|
|
|
|
|
|
|
def test_issue1506():
|
|
|
|
nlp = English()
|
|
|
|
|
|
|
|
def string_generator():
|
2017-11-11 11:31:59 +03:00
|
|
|
for _ in range(10001):
|
|
|
|
yield "It's sentence produced by that bug."
|
2017-11-11 03:11:27 +03:00
|
|
|
|
2017-11-14 17:45:50 +03:00
|
|
|
yield "Oh snap."
|
|
|
|
|
2017-11-11 11:31:59 +03:00
|
|
|
for _ in range(10001):
|
|
|
|
yield "I erase lemmas."
|
2017-11-11 03:11:27 +03:00
|
|
|
|
2017-11-11 11:31:59 +03:00
|
|
|
for _ in range(10001):
|
|
|
|
yield "It's sentence produced by that bug."
|
2017-11-11 03:11:27 +03:00
|
|
|
|
2017-11-14 17:45:50 +03:00
|
|
|
for _ in range(10001):
|
|
|
|
yield "It's sentence produced by that bug."
|
|
|
|
|
|
|
|
anchor = None
|
|
|
|
remember = None
|
|
|
|
for i, d in enumerate(nlp.pipe(string_generator())):
|
|
|
|
if i == 9999:
|
|
|
|
anchor = d
|
|
|
|
elif 10001 == i:
|
|
|
|
remember = d
|
|
|
|
elif i == 10002:
|
|
|
|
del anchor
|
|
|
|
gc.collect()
|
|
|
|
|
|
|
|
assert remember.text == 'Oh snap.'
|