From 786a4a86fef72bece02e601014ad6fd5b516220a Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 1 Sep 2014 23:26:49 +0200 Subject: [PATCH] * Add tests for canon_case --- tests/test_canon_case.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/test_canon_case.py diff --git a/tests/test_canon_case.py b/tests/test_canon_case.py new file mode 100644 index 000000000..4b0fd21b3 --- /dev/null +++ b/tests/test_canon_case.py @@ -0,0 +1,20 @@ +from __future__ import unicode_literals + +import py.test + +from spacy.orth import canon_case as cc + +def test_nasa(): + assert cc('Nasa', 0.0, 0, {'upper': 0.6, 'title': 0.3, 'lower': 0.1}, {}) == 'NASA' + + +def test_john(): + assert cc('john', 0.0, 0, {'title': 0.6, 'upper': 0.3, 'lower': 0.1}, {}) == 'John' + + +def test_apple(): + assert cc('apple', 0.0, 0, {'lower': 0.6, 'title': 0.3, 'upper': 0.1}, {}) == 'apple' + + +def test_tie(): + assert cc('I', 0.0, 0, {'lower': 0.0, 'title': 0.0, 'upper': 0.0}, {}) == 'I'