aboutsummaryrefslogtreecommitdiffstats
path: root/test/extractor/text/test_summary.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/extractor/text/test_summary.py')
-rw-r--r--test/extractor/text/test_summary.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/extractor/text/test_summary.py b/test/extractor/text/test_summary.py
index 78d3002..aee1ee2 100644
--- a/test/extractor/text/test_summary.py
+++ b/test/extractor/text/test_summary.py
@@ -36,14 +36,20 @@ class TestTextMetrics(unittest.TestCase):
path = os.path.join(os.path.dirname(__file__), 'example-en.txt')
# fetch document
text = rdr(path)
-
+ # empty input yields no triples
+ self.assertEqual(list(ext.extract(subject, [], principals)), [])
+ self.assertEqual(list(ext.extract(subject, [' '], principals)), [])
+ self.assertEqual(list(ext.extract(subject, [' ', ' ', ' '], principals)), [])
+ # creates a summary
with warnings.catch_warnings():
warnings.simplefilter('ignore', category=FutureWarning)
triples = list(ext.extract(subject, text, principals))
-
self.assertEqual(triples, [
(subject, ext.schema.predicate(ns.bse.summary),
'Alice is tired of sitting by her sister on the bank')])
+ # skip unknown predicates
+ self.assertSetEqual(set(), set(ext.extract(subject, text,
+ {ext.schema.predicate(ns.bsfs.Predicate).child(ns.bse.unknown)})))
## main ##