aboutsummaryrefslogtreecommitdiffstats
path: root/test/extractor/text/test_summary.py
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2023-07-28 12:00:11 +0200
committerMatthias Baumgartner <dev@igsor.net>2023-07-28 12:00:11 +0200
commitcf032db8785149689d94232b400e20e4d6336562 (patch)
treec912f62227b06430bf4c11a820c0a4b34b46512c /test/extractor/text/test_summary.py
parent11b26a913d39edb7f36cd0a3b3d8e74c96738579 (diff)
downloadbsie-cf032db8785149689d94232b400e20e4d6336562.tar.gz
bsie-cf032db8785149689d94232b400e20e4d6336562.tar.bz2
bsie-cf032db8785149689d94232b400e20e4d6336562.zip
minor style and text fixesdevelop
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 ##