From 719221a2159683f4647a5c7e6fc2f3be2d585364 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 13 Oct 2015 20:20:10 +1100 Subject: [PATCH] * Fix StringIO for Python 3 --- tests/morphology/test_morphology_pickle.py | 4 ++-- tests/parser/test_parser_pickle.py | 5 +++-- tests/test_pickle.py | 4 ++-- tests/vocab/test_vocab.py | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/morphology/test_morphology_pickle.py b/tests/morphology/test_morphology_pickle.py index f1b5bcd4c..d8cb88370 100644 --- a/tests/morphology/test_morphology_pickle.py +++ b/tests/morphology/test_morphology_pickle.py @@ -1,7 +1,7 @@ import pytest import pickle -import StringIO +import io from spacy.morphology import Morphology @@ -12,6 +12,6 @@ from spacy.strings import StringStore def test_pickle(): morphology = Morphology(StringStore(), {}, Lemmatizer({}, {}, {})) - file_ = StringIO.StringIO() + file_ = io.BytesIO() pickle.dump(morphology, file_) diff --git a/tests/parser/test_parser_pickle.py b/tests/parser/test_parser_pickle.py index b1b768650..547bf4a24 100644 --- a/tests/parser/test_parser_pickle.py +++ b/tests/parser/test_parser_pickle.py @@ -2,12 +2,13 @@ import pytest import pickle import cloudpickle -import StringIO + +import io @pytest.mark.models def test_pickle(EN): - file_ = StringIO.StringIO() + file_ = io.BytesIO() cloudpickle.dump(EN.parser, file_) file_.seek(0) diff --git a/tests/test_pickle.py b/tests/test_pickle.py index 02d908b0d..a3d54c627 100644 --- a/tests/test_pickle.py +++ b/tests/test_pickle.py @@ -1,12 +1,12 @@ import pytest -import StringIO +import io import cloudpickle import pickle @pytest.mark.models def test_pickle_english(EN): - file_ = StringIO.StringIO() + file_ = io.BytesIO() cloudpickle.dump(EN, file_) file_.seek(0) diff --git a/tests/vocab/test_vocab.py b/tests/vocab/test_vocab.py index 5981f30e7..eedf579de 100644 --- a/tests/vocab/test_vocab.py +++ b/tests/vocab/test_vocab.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals import pytest -import StringIO +import io import cloudpickle import pickle @@ -46,7 +46,7 @@ def test_symbols(en_vocab): def test_pickle_vocab(en_vocab): - file_ = StringIO.StringIO() + file_ = io.BytesIO() cloudpickle.dump(en_vocab, file_) file_.seek(0)