def test_triples_choices_contexts(): iom = IOMemory() ctx = 'http://example.org/ctx' ctx1 = 'http://example.org/ctx1' iom.add((URIRef('http://example.org/a'), URIRef('http://example.org/b'), URIRef('http://example.org/c')), context=ctx) iom.add((URIRef('http://example.org/a'), URIRef('http://example.org/b'), URIRef('http://example.org/c')), context=ctx1) bds = BundleDependencyStore(iom) for t, ctxs in bds.triples_choices( ([URIRef('http://example.org/a')], None, None)): assert set([ctx, ctx1]) == set(ctxs)
def test_triples_choices_excluded(): iom = IOMemory() iom.add((URIRef('http://example.org/a'), URIRef('http://example.org/b'), URIRef('http://example.org/c')), context='http://example.org/ctx') iom.add((URIRef('http://example.org/e'), URIRef('http://example.org/b'), URIRef('http://example.org/d')), context='http://example.org/ctx') bds = BundleDependencyStore(iom, excludes=set(['http://example.org/ctx'])) assert set() == set( bds.triples_choices( (None, None, [URIRef('http://example.org/c'), URIRef('http://example.org/d')])))