From d8276b3792960cbbafe6718fcc2d307a2292532e Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 28 Sep 2015 19:34:34 +1000 Subject: [PATCH] * Move test_home to within tests/ --- {website/tests => tests/website}/test_home.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) rename {website/tests => tests/website}/test_home.py (95%) diff --git a/website/tests/test_home.py b/tests/website/test_home.py similarity index 95% rename from website/tests/test_home.py rename to tests/website/test_home.py index 3b27ba2f7..8c1ab9b8e 100644 --- a/website/tests/test_home.py +++ b/tests/website/test_home.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals import pytest +import spacy.en @pytest.fixture(scope="session") @@ -36,7 +37,7 @@ def test_use_integer_ids_for_any_strings(nlp, token): hello_id = nlp.vocab.strings['Hello'] hello_str = nlp.vocab.strings[hello_id] - assert token.orth == hello_id == 469755 + assert token.orth == hello_id == 3404 assert token.orth_ == hello_str == 'Hello' @@ -71,7 +72,7 @@ def test_word_vectors(nlp): doc = nlp("Apples and oranges are similar. Boots and hippos aren't.") apples = doc[0] - oranges = doc[1] + oranges = doc[2] boots = doc[6] hippos = doc[8] @@ -157,10 +158,12 @@ def test_calculate_inline_mark_up_on_original_string(): @pytest.mark.models def test_efficient_binary_serialization(doc): - byte_string = doc.as_bytes() + from spacy.tokens.doc import Doc + + byte_string = doc.to_bytes() open('/tmp/moby_dick.bin', 'wb').write(byte_string) nlp = spacy.en.English() - for byte_string in Doc.read(open('/tmp/moby_dick.bin', 'rb')): + for byte_string in Doc.read_bytes(open('/tmp/moby_dick.bin', 'rb')): doc = Doc(nlp.vocab) doc.from_bytes(byte_string)