2015-01-05 06:54:54 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2014-11-02 13:23:04 +00:00
|
|
|
from spacy.orth import like_url
|
2014-11-02 02:21:57 +00:00
|
|
|
|
|
|
|
def test_basic_url():
|
2014-11-02 13:23:04 +00:00
|
|
|
assert like_url('www.google.com')
|
|
|
|
assert like_url('google.com')
|
|
|
|
assert like_url('sydney.com')
|
|
|
|
assert like_url('Sydney.edu')
|
|
|
|
assert like_url('2girls1cup.org')
|
2014-11-02 02:21:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_close_enough():
|
2014-11-02 13:23:04 +00:00
|
|
|
assert like_url('http://stupid')
|
|
|
|
assert like_url('www.hi')
|
2014-11-02 02:21:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_non_match():
|
2014-11-02 13:23:04 +00:00
|
|
|
assert not like_url('dog')
|
|
|
|
assert not like_url('1.2')
|
|
|
|
assert not like_url('1.a')
|
|
|
|
assert not like_url('hello.There')
|