From 42a18ef9030f883563c4459aec46563877274794 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 23 Jan 2018 23:27:05 +0100 Subject: [PATCH] Add test for #1868: Vocab.__contains__ with ints --- spacy/tests/regression/test_issue1868.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 spacy/tests/regression/test_issue1868.py diff --git a/spacy/tests/regression/test_issue1868.py b/spacy/tests/regression/test_issue1868.py new file mode 100644 index 000000000..6d9da45cc --- /dev/null +++ b/spacy/tests/regression/test_issue1868.py @@ -0,0 +1,13 @@ +'''Test Vocab.__contains__ works with int keys''' +from __future__ import unicode_literals + +from ... vocab import Vocab + +def test_issue1868(): + vocab = Vocab() + lex = vocab['hello'] + assert lex.orth in vocab + assert lex.orth_ in vocab + assert 'some string' not in vocab + int_id = vocab.strings.add('some string') + assert int_id not in vocab