From c414d0eebe13f2d5ac3c6a5fef443f197e37330e Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 1 Nov 2014 19:13:40 +1100 Subject: [PATCH] * Add tests for is_number --- tests/test_number.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/test_number.py diff --git a/tests/test_number.py b/tests/test_number.py new file mode 100644 index 000000000..e7def8fe8 --- /dev/null +++ b/tests/test_number.py @@ -0,0 +1,34 @@ +from spacy.orth import is_number + + +def test_digits(): + assert is_number('10') + assert is_number('1') + + +def test_comma(): + assert is_number('10,000') + assert is_number('10,00') + assert is_number(',10') + + +def test_period(): + assert is_number('999.0') + assert is_number('.99') + + +def test_fraction(): + assert is_number('1/2') + assert not is_number('1/2/3') + + +def test_word(): + assert is_number('one') + assert is_number('two') + assert is_number('billion') + + +def test_not_number(): + assert not is_number('dog') + assert not is_number(',') +