Test workaround for Issue #285: Streaming data memory growth

This commit is contained in:
Matthew Honnibal 2016-10-24 13:48:06 +02:00
parent 64e5f02cf7
commit d3a617aa99

View File

@ -0,0 +1,21 @@
'''Test the possibly temporary workaround of flushing the stringstore of OOV words.'''
import pytest
from ...strings import StringStore
def test_oov():
strings = StringStore()
a = strings[u'a']
b = strings[u'b']
assert a == 1
assert b == 2
strings.set_frozen(True)
c = strings[u'c']
assert c >= 4
c_ = strings[c]
assert c_ == u'c'
strings.flush_oov()
with pytest.raises(IndexError):
c_ = strings[c]