blob: 4eb36c38965875c9b2564357d8dd7e680ec385d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
"""
Part of the bsfs test suite.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2022
"""
# imports
import unittest
# bsie imports
from bsfs.graph import Graph
from bsfs.graph.ac import NullAC
from bsfs.triple_store import SparqlStore
from bsfs.utils import errors, URI
# objects to test
from bsfs.front.bsfs import Open
## code ##
class TestBSFS(unittest.TestCase):
def test_open(self):
# valid config produces a valid graph
config = {'Graph': {'backend': {'SparqlStore': {}}, 'user': 'http://example.com/me'}}
graph = Open(config)
self.assertIsInstance(graph, Graph)
self.assertIsInstance(graph._backend, SparqlStore)
self.assertEqual(graph._ac, NullAC(graph._backend, URI('http://example.com/me')))
# invalid config raises an error
self.assertRaises(errors.ConfigError, Open, {})
## main ##
if __name__ == '__main__':
unittest.main()
## EOF ##
|