File: test_issue579.py

package info (click to toggle)
rdflib 6.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 38,248 kB
  • sloc: python: 39,216; sh: 153; makefile: 110
file content (18 lines) | stat: -rw-r--r-- 563 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# test for https://github.com/RDFLib/rdflib/issues/579

from rdflib import Graph, URIRef, Literal, Namespace
from rdflib.namespace import FOAF, RDF


def test_issue579():
    g = Graph()
    g.bind("foaf", FOAF)
    n = Namespace("http://myname/")
    g.add((n.bob, FOAF.name, Literal("bb")))
    # query is successful.
    assert len(g.query("select ?n where { ?n foaf:name 'bb' . }")) == 1
    # update is not.
    g.update("delete where { ?e foaf:name 'ss' .}")
    assert len(g) == 1
    g.update("delete where { ?e foaf:name 'bb' .}")
    assert len(g) == 0