added lex test for is_currency

This commit is contained in:
4altinok 2018-02-11 18:50:50 +01:00
parent c63e99da8a
commit 471d3c9e23

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from ...attrs import intify_attrs, ORTH, NORM, LEMMA, IS_ALPHA 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 import pytest
@ -37,6 +37,13 @@ def test_lex_attrs_is_ascii(text, match):
assert 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', [ @pytest.mark.parametrize('text,match', [
('www.google.com', True), ('google.com', True), ('sydney.com', True), ('www.google.com', True), ('google.com', True), ('sydney.com', True),
('2girls1cup.org', True), ('http://stupid', True), ('www.hi', True), ('2girls1cup.org', True), ('http://stupid', True), ('www.hi', True),