From 6209d94f8386b9445298a213c4876b5f1898785c Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 30 Aug 2014 19:00:10 +0200 Subject: [PATCH] * Add tests for word shape --- tests/test_shape.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/test_shape.py diff --git a/tests/test_shape.py b/tests/test_shape.py new file mode 100644 index 000000000..8231b2c94 --- /dev/null +++ b/tests/test_shape.py @@ -0,0 +1,27 @@ +from __future__ import unicode_literals + +import pytest + +from spacy.orth import word_shape as ws + + +def test_capitalized(): + assert ws('Nasa') == 'Xxxx' + +def test_truncate(): + assert ws('capitalized') == 'xxx' + +def test_digits(): + assert ws('999999999') == 'ddd' + +def test_mix(): + assert ws('C3P0') == 'XdXd' + +def test_punct(): + assert ws(',') == ',' + +def test_space(): + assert ws('\n') == '\n' + +def test_punct_seq(): + assert ws('``,-') == '``,-'