From 5668feb235dae456843507e7054508f55b79e8c3 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 3 Nov 2015 04:57:02 +0100 Subject: [PATCH] * Fix pickle test for python3 --- spacy/tests/test_pickle.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spacy/tests/test_pickle.py b/spacy/tests/test_pickle.py index 540e54486..2577f58a6 100644 --- a/spacy/tests/test_pickle.py +++ b/spacy/tests/test_pickle.py @@ -5,6 +5,11 @@ import pickle import pytest import tempfile +try: + unicode +except NameError: + unicode = str + @pytest.mark.models def test_pickle_english(EN): file_ = io.BytesIO() @@ -21,7 +26,7 @@ def test_cloudpickle_to_file(EN): p = cloudpickle.CloudPickler(f) p.dump(EN) f.close() - loaded_en = cloudpickle.load(open(f.name)) + loaded_en = cloudpickle.load(open(f.name, 'rb')) os.unlink(f.name) doc = loaded_en(unicode('test parse')) assert len(doc) == 2