diff options
Diffstat (limited to 'test/lib/test_bsie.py')
-rw-r--r-- | test/lib/test_bsie.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test/lib/test_bsie.py b/test/lib/test_bsie.py index 6586e58..a154477 100644 --- a/test/lib/test_bsie.py +++ b/test/lib/test_bsie.py @@ -6,9 +6,10 @@ import unittest # bsie imports from bsie.extractor import ExtractorBuilder from bsie.extractor.base import SCHEMA_PREAMBLE -from bsie.lib import PipelineBuilder, DefaultNamingPolicy +from bsie.lib import PipelineBuilder +from bsie.matcher import nodes, DefaultMatcher from bsie.reader import ReaderBuilder -from bsie.utils import bsfs, node, ns +from bsie.utils import bsfs, ns # objects to test from bsie.lib.bsie import BSIE @@ -35,13 +36,13 @@ class TestBSIE(unittest.TestCase): )}, ]) # build pipeline - self.naming_policy = DefaultNamingPolicy(host='http://example.com/local', user='me') + self.matcher = DefaultMatcher(host='http://example.com/local', user='me') pbuild = PipelineBuilder(rbuild, ebuild) self.pipeline = pbuild.build() def test_construction(self): # only pipeline and naming policy - lib = BSIE(self.pipeline, self.naming_policy) + lib = BSIE(self.pipeline, self.matcher) self.assertSetEqual(set(lib.principals), { ns.bse.filename, ns.bse.dirname, @@ -71,7 +72,7 @@ class TestBSIE(unittest.TestCase): ''')) # specify collect - lib = BSIE(self.pipeline, self.naming_policy, collect={ + lib = BSIE(self.pipeline, self.matcher, collect={ ns.bse.filesize, ns.bse.author, ns.bse.inexistent, @@ -92,7 +93,7 @@ class TestBSIE(unittest.TestCase): bsfs:unique "true"^^xsd:boolean . ''')) # empty collect is disregarded - lib = BSIE(self.pipeline, self.naming_policy, collect={}) + lib = BSIE(self.pipeline, self.matcher, collect={}) self.assertSetEqual(set(lib.principals), { ns.bse.filename, ns.bse.dirname, @@ -123,7 +124,7 @@ class TestBSIE(unittest.TestCase): ''')) # specify discard - lib = BSIE(self.pipeline, self.naming_policy, discard={ + lib = BSIE(self.pipeline, self.matcher, discard={ ns.bse.filesize, ns.bse.filename, ns.bse.inexistent, @@ -151,7 +152,7 @@ class TestBSIE(unittest.TestCase): ''')) # specify collect and discard - lib = BSIE(self.pipeline, self.naming_policy, + lib = BSIE(self.pipeline, self.matcher, collect={ns.bse.filesize, ns.bse.author, ns.bse.foo, ns.bse.bar}, discard={ns.bse.author, ns.bse.foo, ns.bse.foobar}, ) @@ -168,7 +169,7 @@ class TestBSIE(unittest.TestCase): def test_from_file(self): # setup - lib = BSIE(self.pipeline, self.naming_policy) + lib = BSIE(self.pipeline, self.matcher) self.assertSetEqual(set(lib.principals), { ns.bse.filesize, ns.bse.filename, @@ -176,7 +177,10 @@ class TestBSIE(unittest.TestCase): ns.bse.author, }) content_hash = 'a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447' - subject = node.Node(ns.bsn.Entity, uri=f'http://example.com/local/me/file#{content_hash}') + subject = nodes.Entity( + uri=f'http://example.com/local/me/file#{content_hash}', + ucid=content_hash, + ) testfile = os.path.join(os.path.dirname(__file__), 'testfile.t') # from_file extracts all available triples |