mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +03:00
Test workaround for Issue #285: Streaming data memory growth
This commit is contained in:
parent
64e5f02cf7
commit
d3a617aa99
21
spacy/tests/vocab/test_freeze_string_store.py
Normal file
21
spacy/tests/vocab/test_freeze_string_store.py
Normal 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]
|
Loading…
Reference in New Issue
Block a user