From 3fa5b40b5cace40a5b8fde8112354abce6488b77 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 16 Sep 2017 11:21:35 +0200 Subject: [PATCH] Add test for hash consistency --- spacy/tests/stringstore/test_stringstore.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spacy/tests/stringstore/test_stringstore.py b/spacy/tests/stringstore/test_stringstore.py index 65b994606..602ebcee6 100644 --- a/spacy/tests/stringstore/test_stringstore.py +++ b/spacy/tests/stringstore/test_stringstore.py @@ -6,6 +6,16 @@ from ...strings import StringStore import pytest +def test_string_hash(stringstore): + '''Test that string hashing is stable across platforms''' + ss = stringstore + assert ss.add('apple') == 8566208034543834098 + heart = '\U0001f499' + print(heart) + h = ss.add(heart) + assert h == 11841826740069053588L + + def test_stringstore_from_api_docs(stringstore): apple_hash = stringstore.add('apple') assert apple_hash == 8566208034543834098