def test_graph_sparql(self): config = { 'store': { 'query': 'http://localhost:3030/gk-test/query', 'update': 'http://localhost:3030/gk-test/update' } } graph = Graph(config=config) assert graph.store is not None, graph.store assert 'SPARQLUpdateStore' in repr(graph.store), graph.store assert graph.buffered is True, graph.buffered
def make_test_graph(buffered=False): from jsongraph.graph import Graph config = { 'buffered': buffered, 'schemas': { 'persons': PERSON_URI, 'organizations': ORG_URI } } if 'JSONGRAPH_TEST_SPARQL_QUERY' in os.environ: config['store'] = { 'query': os.environ.get('JSONGRAPH_TEST_SPARQL_QUERY'), 'update': os.environ.get('JSONGRAPH_TEST_SPARQL_UPDATE') } return Graph(config=config, resolver=resolver)
def test_invalid_store_config(self): Graph(config={'store': {'update': 6, 'query': 'huhu'}})
def test_invalid_schema_config(self): Graph(config={'schemas': 5})
def test_graph_unconfigured(self): graph = Graph() assert graph.base_uri is not None assert graph.resolver is not None
def test_graph(self): graph = Graph() assert 'github.io' in graph.base_uri, graph.base_uri assert graph.get_schema({}) == {}, graph.get_schema({}) assert 'github.io' in repr(graph), repr(graph) assert str(graph) in repr(graph), repr(graph)
def test_missing_schema(self): graph = Graph() graph.get_schema('foo')