Add test for hash consistency

This commit is contained in:
Matthew Honnibal 2017-09-16 11:21:35 +02:00
parent f730d07e4e
commit 3fa5b40b5c
1 changed files with 10 additions and 0 deletions

View File

@ -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