diff options
author | Matthias Baumgartner <dev@igsor.net> | 2022-12-18 14:16:06 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2022-12-18 14:16:06 +0100 |
commit | a5ce14c8bbd55f4a078ceea9384cda56bf42a18b (patch) | |
tree | 392381e735aeb466589eabcedfd8cd16bdf6e724 | |
parent | e19c8f9d0818a147832df0945188ea14de9c7690 (diff) | |
download | bsfs-a5ce14c8bbd55f4a078ceea9384cda56bf42a18b.tar.gz bsfs-a5ce14c8bbd55f4a078ceea9384cda56bf42a18b.tar.bz2 bsfs-a5ce14c8bbd55f4a078ceea9384cda56bf42a18b.zip |
SparqlStore.exists bugfix
-rw-r--r-- | bsfs/triple_store/sparql.py | 6 | ||||
-rw-r--r-- | test/triple_store/test_sparql.py | 18 |
2 files changed, 11 insertions, 13 deletions
diff --git a/bsfs/triple_store/sparql.py b/bsfs/triple_store/sparql.py index 23059f7..7516dff 100644 --- a/bsfs/triple_store/sparql.py +++ b/bsfs/triple_store/sparql.py @@ -174,10 +174,8 @@ class SparqlStore(base.TripleStoreBase): self, node_type: bsc.Node, guids: typing.Iterable[URI], - ): - """ - """ - return {subj for subj in guids if self._has_type(subj, node_type)} + ) -> typing.Iterable[URI]: + return (subj for subj in guids if self._has_type(subj, node_type)) def create( self, diff --git a/test/triple_store/test_sparql.py b/test/triple_store/test_sparql.py index c4925c4..8d98749 100644 --- a/test/triple_store/test_sparql.py +++ b/test/triple_store/test_sparql.py @@ -476,23 +476,23 @@ class TestSparqlStore(unittest.TestCase): store.create(tag_type, tag_ids) # exists returns all existing nodes of the correct type - self.assertSetEqual(ent_ids, store.exists(ent_type, ent_ids)) - self.assertSetEqual(tag_ids, store.exists(tag_type, tag_ids)) + self.assertSetEqual(ent_ids, set(store.exists(ent_type, ent_ids))) + self.assertSetEqual(tag_ids, set(store.exists(tag_type, tag_ids))) # exists returns only nodes that match the type - self.assertSetEqual(set(), store.exists(ent_type, tag_ids)) - self.assertSetEqual({URI('http://example.com/me/entity#1234')}, store.exists(ent_type, { + self.assertSetEqual(set(), set(store.exists(ent_type, tag_ids))) + self.assertSetEqual({URI('http://example.com/me/entity#1234')}, set(store.exists(ent_type, { URI('http://example.com/me/tag#1234'), URI('http://example.com/me/entity#1234'), - })) + }))) # exists returns only nodes that exist - self.assertSetEqual(set(), store.exists(ent_type, { + self.assertSetEqual(set(), set(store.exists(ent_type, { URI('http://example.com/me/entity#foo'), URI('http://example.com/me/entity#bar'), - })) - self.assertSetEqual({URI('http://example.com/me/entity#1234')}, store.exists(ent_type, { + }))) + self.assertSetEqual({URI('http://example.com/me/entity#1234')}, set(store.exists(ent_type, { URI('http://example.com/me/entity#foo'), URI('http://example.com/me/entity#1234'), - })) + }))) def test_create(self): |