From 6b3e32b29799a8143e8ce9d20c5f27e3e166b9bb Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Thu, 12 Jan 2023 10:17:07 +0100 Subject: changed path to from_string in clients --- test/apps/test_migrate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/apps') diff --git a/test/apps/test_migrate.py b/test/apps/test_migrate.py index 957509a..230c032 100644 --- a/test/apps/test_migrate.py +++ b/test/apps/test_migrate.py @@ -13,7 +13,7 @@ import unittest import unittest.mock # bsie imports -from bsfs.schema import Schema +from bsfs import schema # objects to test from bsfs.apps.migrate import main @@ -33,21 +33,21 @@ class TestMigrate(unittest.TestCase): # read schema from file with open(schema_1) as ifile: - target = Schema.from_string(ifile.read()) + target = schema.from_string(ifile.read()) graph = main([config, schema_1]) self.assertTrue(target <= graph.schema) # read schema from multiple files with open(schema_1) as ifile: - target = Schema.from_string(ifile.read()) + target = schema.from_string(ifile.read()) with open(schema_2) as ifile: - target = target + Schema.from_string(ifile.read()) + target = target + schema.from_string(ifile.read()) graph = main([config, schema_1, schema_2]) self.assertTrue(target <= graph.schema) # read schema from stdin with open(schema_1, 'rt') as ifile: - target = Schema.from_string(ifile.read()) + target = schema.from_string(ifile.read()) with open(schema_1, 'rt') as ifile: with unittest.mock.patch('sys.stdin', ifile): graph = main([config]) -- cgit v1.2.3 From b0ff4ed674ad78bf113c3cc0c2ccd187ccb91048 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Thu, 12 Jan 2023 10:26:30 +0100 Subject: number literal adaptions --- test/apps/schema-2.nt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/apps') diff --git a/test/apps/schema-2.nt b/test/apps/schema-2.nt index 525ac99..4c5468f 100644 --- a/test/apps/schema-2.nt +++ b/test/apps/schema-2.nt @@ -10,7 +10,8 @@ prefix bse: bsfs:Entity rdfs:subClassOf bsfs:Node . # common definitions -xsd:integer rdfs:subClassOf bsfs:Literal . +bsfs:Number rdfs:subClassOf bsfs:Literal . +xsd:integer rdfs:subClassOf bsfs:Number . bse:filesize rdfs:subClassOf bsfs:Predicate ; rdfs:domain bsfs:Entity ; -- cgit v1.2.3 From d822df3dad0525f35dbacda9d5a66f4756f079ff Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Wed, 1 Mar 2023 12:49:47 +0100 Subject: Integrate main app into package --- test/apps/test_main.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test/apps/test_main.py (limited to 'test/apps') diff --git a/test/apps/test_main.py b/test/apps/test_main.py new file mode 100644 index 0000000..ae19b5e --- /dev/null +++ b/test/apps/test_main.py @@ -0,0 +1,42 @@ +""" + +Part of the bsfs test suite. +A copy of the license is provided with the project. +Author: Matthias Baumgartner, 2022 +""" +# imports +import contextlib +import io +import json +import unittest + +# objects to test +from bsfs.apps import main + + +## code ## + +class TestMain(unittest.TestCase): + def test_main(self): + # must at least pass an app + with contextlib.redirect_stderr(io.StringIO()): + self.assertRaises(SystemExit, main, []) + # app takes over + with contextlib.redirect_stderr(io.StringIO()): + self.assertRaises(SystemExit, main, ['init']) + outbuf = io.StringIO() + with contextlib.redirect_stdout(outbuf): + main(['init', 'sparql']) + self.assertEqual(json.loads(outbuf.getvalue()), { + 'Graph': { + 'user': 'http://example.com/me', + 'backend': { + 'SparqlStore': {}}}}) + + +## main ## + +if __name__ == '__main__': + unittest.main() + +## EOF ## -- cgit v1.2.3 From 2e07f33314c238e42bfadc5f39805f93ffbc622e Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Thu, 2 Mar 2023 15:10:05 +0100 Subject: removed author and license notices from individual files --- test/apps/test_init.py | 5 ----- test/apps/test_main.py | 5 ----- test/apps/test_migrate.py | 5 ----- 3 files changed, 15 deletions(-) (limited to 'test/apps') diff --git a/test/apps/test_init.py b/test/apps/test_init.py index bae6a68..59e10eb 100644 --- a/test/apps/test_init.py +++ b/test/apps/test_init.py @@ -1,9 +1,4 @@ -""" -Part of the bsfs test suite. -A copy of the license is provided with the project. -Author: Matthias Baumgartner, 2022 -""" # imports import contextlib import io diff --git a/test/apps/test_main.py b/test/apps/test_main.py index ae19b5e..d61372f 100644 --- a/test/apps/test_main.py +++ b/test/apps/test_main.py @@ -1,9 +1,4 @@ -""" -Part of the bsfs test suite. -A copy of the license is provided with the project. -Author: Matthias Baumgartner, 2022 -""" # imports import contextlib import io diff --git a/test/apps/test_migrate.py b/test/apps/test_migrate.py index 230c032..618cb37 100644 --- a/test/apps/test_migrate.py +++ b/test/apps/test_migrate.py @@ -1,9 +1,4 @@ -""" -Part of the bsfs test suite. -A copy of the license is provided with the project. -Author: Matthias Baumgartner, 2022 -""" # imports import contextlib import io -- cgit v1.2.3 From 4fead04055be4967d9ea3b24ff61fe37a93108dd Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 4 Mar 2023 13:31:11 +0100 Subject: namespace refactoring and cleanup --- test/apps/schema-1.nt | 4 ++-- test/apps/schema-2.nt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test/apps') diff --git a/test/apps/schema-1.nt b/test/apps/schema-1.nt index e57146d..4daf0ad 100644 --- a/test/apps/schema-1.nt +++ b/test/apps/schema-1.nt @@ -3,8 +3,8 @@ prefix rdfs: prefix xsd: # common bsfs prefixes -prefix bsfs: -prefix bse: +prefix bsfs: +prefix bse: # essential nodes bsfs:Entity rdfs:subClassOf bsfs:Node . diff --git a/test/apps/schema-2.nt b/test/apps/schema-2.nt index 4c5468f..4eb2467 100644 --- a/test/apps/schema-2.nt +++ b/test/apps/schema-2.nt @@ -3,8 +3,8 @@ prefix rdfs: prefix xsd: # common bsfs prefixes -prefix bsfs: -prefix bse: +prefix bsfs: +prefix bse: # essential nodes bsfs:Entity rdfs:subClassOf bsfs:Node . -- cgit v1.2.3