From 07219685d01f803dc46c8d5465fa542c1d822cb4 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 24 Dec 2022 10:39:51 +0100 Subject: documentation: standard vs external import --- test/apps/test_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/apps/test_info.py') diff --git a/test/apps/test_info.py b/test/apps/test_info.py index 6f4d98f..f52c581 100644 --- a/test/apps/test_info.py +++ b/test/apps/test_info.py @@ -4,7 +4,7 @@ Part of the bsie test suite. A copy of the license is provided with the project. Author: Matthias Baumgartner, 2022 """ -# imports +# standard imports import argparse import contextlib import io -- cgit v1.2.3 From 4f868bcb3be2658960eace3222563cc9a819366a Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Mon, 16 Jan 2023 21:36:11 +0100 Subject: info schema and feature tests --- test/apps/test_info.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/apps/test_info.py') diff --git a/test/apps/test_info.py b/test/apps/test_info.py index f52c581..60e9ba1 100644 --- a/test/apps/test_info.py +++ b/test/apps/test_info.py @@ -10,6 +10,9 @@ import contextlib import io import unittest +# bsie imports +from bsie.utils import bsfs + # objects to test from bsie.apps.info import main @@ -28,6 +31,22 @@ class TestIndex(unittest.TestCase): 'http://bsfs.ai/schema/Predicate', 'http://bsfs.ai/schema/Entity#filename', 'http://bsfs.ai/schema/Entity#filesize', + 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04' + }) + + def test_schema(self): + outbuf = io.StringIO() + with contextlib.redirect_stdout(outbuf): + # show schema infos + main(['schema']) + # verify output + schema = bsfs.schema.from_string(outbuf.getvalue()) + self.assertSetEqual({pred.uri for pred in schema.predicates()}, { + 'http://bsfs.ai/schema/Entity#author', + 'http://bsfs.ai/schema/Predicate', + 'http://bsfs.ai/schema/Entity#filename', + 'http://bsfs.ai/schema/Entity#filesize', + 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04' }) def test_invalid(self): -- cgit v1.2.3 From a281d6b3a75a7d4a97e673c285ee430a327482ed Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Wed, 8 Feb 2023 19:23:46 +0100 Subject: preview extractor --- test/apps/test_info.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test/apps/test_info.py') diff --git a/test/apps/test_info.py b/test/apps/test_info.py index 60e9ba1..725fb65 100644 --- a/test/apps/test_info.py +++ b/test/apps/test_info.py @@ -31,7 +31,11 @@ class TestIndex(unittest.TestCase): 'http://bsfs.ai/schema/Predicate', 'http://bsfs.ai/schema/Entity#filename', 'http://bsfs.ai/schema/Entity#filesize', - 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04' + 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04', + 'http://bsfs.ai/schema/Entity#preview', + 'http://bsfs.ai/schema/Preview#width', + 'http://bsfs.ai/schema/Preview#height', + 'http://bsfs.ai/schema/Preview#asset', }) def test_schema(self): @@ -46,7 +50,11 @@ class TestIndex(unittest.TestCase): 'http://bsfs.ai/schema/Predicate', 'http://bsfs.ai/schema/Entity#filename', 'http://bsfs.ai/schema/Entity#filesize', - 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04' + 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04', + 'http://bsfs.ai/schema/Entity#preview', + 'http://bsfs.ai/schema/Preview#width', + 'http://bsfs.ai/schema/Preview#height', + 'http://bsfs.ai/schema/Preview#asset', }) def test_invalid(self): -- cgit v1.2.3 From 464cc6cb54f55f6255bf0a485533c181d6018303 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Wed, 1 Mar 2023 17:07:06 +0100 Subject: load config from file --- test/apps/test_info.py | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'test/apps/test_info.py') diff --git a/test/apps/test_info.py b/test/apps/test_info.py index 725fb65..cf8d52f 100644 --- a/test/apps/test_info.py +++ b/test/apps/test_info.py @@ -8,8 +8,13 @@ Author: Matthias Baumgartner, 2022 import argparse import contextlib import io +import os +import tempfile import unittest +# external imports +import yaml + # bsie imports from bsie.utils import bsfs @@ -20,17 +25,49 @@ from bsie.apps.info import main ## code ## class TestIndex(unittest.TestCase): + def setUp(self): + config = { + 'ReaderBuilder': {}, + 'ExtractorBuilder': [ + {'bsie.extractor.preview.Preview': { + 'max_sides': [50], + }}, + {'bsie.extractor.generic.path.Path': {}}, + {'bsie.extractor.generic.constant.Constant': { + 'schema': ''' + bse:author rdfs:subClassOf bsfs:Predicate ; + rdfs:domain bsfs:Entity ; + rdfs:range xsd:string ; + bsfs:unique "true"^^xsd:boolean . + ''', + 'tuples': [['http://bsfs.ai/schema/Entity#author', 'Me, myself, and I']], + }}, + {'bsie.extractor.image.colors_spatial.ColorsSpatial': { + 'width': 2, + 'height': 2, + 'exp': 2, + }}, + ] + } + # create config file + _, self.config_path = tempfile.mkstemp(prefix='bsie-test-', suffix='.yaml') + with open(self.config_path, 'wt') as cfile: + yaml.dump(config, cfile) + + def tearDown(self): + if os.path.exists(self.config_path): + os.unlink(self.config_path) + def test_predicates(self): outbuf = io.StringIO() with contextlib.redirect_stdout(outbuf): # show predicates infos - main(['predicates']) + main(['--config', self.config_path, 'predicates']) # verify output self.assertSetEqual({pred for pred in outbuf.getvalue().split('\n') if pred != ''}, { 'http://bsfs.ai/schema/Entity#author', 'http://bsfs.ai/schema/Predicate', 'http://bsfs.ai/schema/Entity#filename', - 'http://bsfs.ai/schema/Entity#filesize', 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04', 'http://bsfs.ai/schema/Entity#preview', 'http://bsfs.ai/schema/Preview#width', @@ -42,14 +79,13 @@ class TestIndex(unittest.TestCase): outbuf = io.StringIO() with contextlib.redirect_stdout(outbuf): # show schema infos - main(['schema']) + main(['--config', self.config_path, 'schema']) # verify output schema = bsfs.schema.from_string(outbuf.getvalue()) self.assertSetEqual({pred.uri for pred in schema.predicates()}, { 'http://bsfs.ai/schema/Entity#author', 'http://bsfs.ai/schema/Predicate', 'http://bsfs.ai/schema/Entity#filename', - 'http://bsfs.ai/schema/Entity#filesize', 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04', 'http://bsfs.ai/schema/Entity#preview', 'http://bsfs.ai/schema/Preview#width', -- cgit v1.2.3 From 4b5c4d486bb4f0f4da2e25ad464e8336a781cdcb Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Wed, 1 Mar 2023 22:31:03 +0100 Subject: removed module header stubs --- test/apps/test_info.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'test/apps/test_info.py') diff --git a/test/apps/test_info.py b/test/apps/test_info.py index cf8d52f..d705629 100644 --- a/test/apps/test_info.py +++ b/test/apps/test_info.py @@ -1,9 +1,4 @@ -""" -Part of the bsie test suite. -A copy of the license is provided with the project. -Author: Matthias Baumgartner, 2022 -""" # standard imports import argparse import contextlib -- cgit v1.2.3 From d2052e77210e0ace2c5f06e48afe2a8acb412965 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 4 Mar 2023 13:41:13 +0100 Subject: namespace refactoring and cleanup --- test/apps/test_info.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'test/apps/test_info.py') diff --git a/test/apps/test_info.py b/test/apps/test_info.py index d705629..ffcaecf 100644 --- a/test/apps/test_info.py +++ b/test/apps/test_info.py @@ -31,11 +31,11 @@ class TestIndex(unittest.TestCase): {'bsie.extractor.generic.constant.Constant': { 'schema': ''' bse:author rdfs:subClassOf bsfs:Predicate ; - rdfs:domain bsfs:Entity ; + rdfs:domain bsn:Entity ; rdfs:range xsd:string ; bsfs:unique "true"^^xsd:boolean . ''', - 'tuples': [['http://bsfs.ai/schema/Entity#author', 'Me, myself, and I']], + 'tuples': [['https://schema.bsfs.io/ie/Node/Entity#author', 'Me, myself, and I']], }}, {'bsie.extractor.image.colors_spatial.ColorsSpatial': { 'width': 2, @@ -60,14 +60,14 @@ class TestIndex(unittest.TestCase): main(['--config', self.config_path, 'predicates']) # verify output self.assertSetEqual({pred for pred in outbuf.getvalue().split('\n') if pred != ''}, { - 'http://bsfs.ai/schema/Entity#author', - 'http://bsfs.ai/schema/Predicate', - 'http://bsfs.ai/schema/Entity#filename', - 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04', - 'http://bsfs.ai/schema/Entity#preview', - 'http://bsfs.ai/schema/Preview#width', - 'http://bsfs.ai/schema/Preview#height', - 'http://bsfs.ai/schema/Preview#asset', + 'https://schema.bsfs.io/ie/Node/Entity#author', + 'https://schema.bsfs.io/core/Predicate', + 'https://schema.bsfs.io/ie/Node/Entity#filename', + 'https://schema.bsfs.io/ie/Node/Entity#colors_spatial_0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04', + 'https://schema.bsfs.io/ie/Node/Entity#preview', + 'https://schema.bsfs.io/ie/Node/Preview#width', + 'https://schema.bsfs.io/ie/Node/Preview#height', + 'https://schema.bsfs.io/ie/Node/Preview#asset', }) def test_schema(self): @@ -78,14 +78,14 @@ class TestIndex(unittest.TestCase): # verify output schema = bsfs.schema.from_string(outbuf.getvalue()) self.assertSetEqual({pred.uri for pred in schema.predicates()}, { - 'http://bsfs.ai/schema/Entity#author', - 'http://bsfs.ai/schema/Predicate', - 'http://bsfs.ai/schema/Entity#filename', - 'http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04', - 'http://bsfs.ai/schema/Entity#preview', - 'http://bsfs.ai/schema/Preview#width', - 'http://bsfs.ai/schema/Preview#height', - 'http://bsfs.ai/schema/Preview#asset', + 'https://schema.bsfs.io/ie/Node/Entity#author', + 'https://schema.bsfs.io/core/Predicate', + 'https://schema.bsfs.io/ie/Node/Entity#filename', + 'https://schema.bsfs.io/ie/Node/Entity#colors_spatial_0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04', + 'https://schema.bsfs.io/ie/Node/Entity#preview', + 'https://schema.bsfs.io/ie/Node/Preview#width', + 'https://schema.bsfs.io/ie/Node/Preview#height', + 'https://schema.bsfs.io/ie/Node/Preview#asset', }) def test_invalid(self): -- cgit v1.2.3