mirror of https://github.com/explosion/spaCy.git
* Fix pickle test for python3
This commit is contained in:
parent
6161d2529a
commit
5668feb235
|
@ -5,6 +5,11 @@ import pickle
|
||||||
import pytest
|
import pytest
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
try:
|
||||||
|
unicode
|
||||||
|
except NameError:
|
||||||
|
unicode = str
|
||||||
|
|
||||||
@pytest.mark.models
|
@pytest.mark.models
|
||||||
def test_pickle_english(EN):
|
def test_pickle_english(EN):
|
||||||
file_ = io.BytesIO()
|
file_ = io.BytesIO()
|
||||||
|
@ -21,7 +26,7 @@ def test_cloudpickle_to_file(EN):
|
||||||
p = cloudpickle.CloudPickler(f)
|
p = cloudpickle.CloudPickler(f)
|
||||||
p.dump(EN)
|
p.dump(EN)
|
||||||
f.close()
|
f.close()
|
||||||
loaded_en = cloudpickle.load(open(f.name))
|
loaded_en = cloudpickle.load(open(f.name, 'rb'))
|
||||||
os.unlink(f.name)
|
os.unlink(f.name)
|
||||||
doc = loaded_en(unicode('test parse'))
|
doc = loaded_en(unicode('test parse'))
|
||||||
assert len(doc) == 2
|
assert len(doc) == 2
|
||||||
|
|
Loading…
Reference in New Issue