From 471d3c9e233240947b2cdb3b79969bcf86abda67 Mon Sep 17 00:00:00 2001 From: 4altinok Date: Sun, 11 Feb 2018 18:50:50 +0100 Subject: [PATCH] added lex test for is_currency --- spacy/tests/lang/test_attrs.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spacy/tests/lang/test_attrs.py b/spacy/tests/lang/test_attrs.py index 92ee04737..67485ee60 100644 --- a/spacy/tests/lang/test_attrs.py +++ b/spacy/tests/lang/test_attrs.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from ...attrs import intify_attrs, ORTH, NORM, LEMMA, IS_ALPHA -from ...lang.lex_attrs import is_punct, is_ascii, like_url, word_shape +from ...lang.lex_attrs import is_punct, is_ascii, is_currency, like_url, word_shape import pytest @@ -37,6 +37,13 @@ def test_lex_attrs_is_ascii(text, match): assert is_ascii(text) == match +@pytest.mark.parametrize('text,match', [('$', True), ('£', True), ('♥', False), + ('€', True), ('¥', True), ('¢', True), + ('a', False), ('www.google.com', False), ('dog', False)]) +def test_lex_attrs_is_currency(text, match): + assert is_currency(text) == match + + @pytest.mark.parametrize('text,match', [ ('www.google.com', True), ('google.com', True), ('sydney.com', True), ('2girls1cup.org', True), ('http://stupid', True), ('www.hi', True),