aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apps/test_index.py6
-rw-r--r--test/extractor/image/test_colors_spatial.py9
2 files changed, 13 insertions, 2 deletions
diff --git a/test/apps/test_index.py b/test/apps/test_index.py
index c3960b8..7f5be8e 100644
--- a/test/apps/test_index.py
+++ b/test/apps/test_index.py
@@ -23,6 +23,12 @@ from bsie.apps.index import main
## code ##
class TestIndex(unittest.TestCase):
+ def test_main_invalid(self):
+ outbuf = io.StringIO()
+ with contextlib.redirect_stdout(outbuf):
+ bsfs = main([os.path.join(os.path.dirname(__file__), 'inexistent-file.t')])
+ self.assertEqual(outbuf.getvalue().strip(), '')
+
def test_main(self):
bsfs = main([
'-r',
diff --git a/test/extractor/image/test_colors_spatial.py b/test/extractor/image/test_colors_spatial.py
index d8a4209..ba551f3 100644
--- a/test/extractor/image/test_colors_spatial.py
+++ b/test/extractor/image/test_colors_spatial.py
@@ -57,8 +57,9 @@ class TestColorsSpatial(unittest.TestCase):
schema = bsfs.schema.from_string(base.SCHEMA_PREAMBLE + f'''
<{self.instance_prefix}> rdfs:subClassOf bsfs:Feature ;
# annotations
- rdfs:label ""^^xsd:string ;
- schema:description ""^^xsd:string .
+ rdfs:label "Spatially dominant colors"^^xsd:string ;
+ schema:description "Domiant colors of subregions in an image."^^xsd:string ;
+ bsfs:dtype xsd:integer .
<{self.instance_prefix}#{self.uuid}> rdfs:subClassOf <{self.instance_prefix}> ;
bsfs:dimension "3276"^^xsd:integer ;
@@ -80,11 +81,15 @@ class TestColorsSpatial(unittest.TestCase):
node = _node.Node(ns.bsfs.Entity, bsfs.URI('http://example.com/entity#1234'))
principals = set(ext.principals)
self.assertEqual(len(principals), 1)
+ # valid invocation yields feature
ret = list(ext.extract(node, img, principals))
self.assertEqual(ret[0], (
node,
list(principals)[0],
(91, 127, 121, 94, 138, 167, 163, 134, 190, 138, 170, 156, 121, 142, 159)))
+ # principals is respected
+ self.assertListEqual(list(ext.extract(node, img, {})), [])
+
## main ##