File: test_issue923.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 (38 lines) | stat: -rw-r--r-- 856 bytes parent folder | download
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
"""
Issue 923: split charset off of Content-Type before looking up Result-parsing plugin.
"""
from io import StringIO

from rdflib.query import Result

RESULT_SOURCE = """\
{
  "head" : {
    "vars" : [ "subject", "predicate", "object", "context" ]
  },
  "results" : {
    "bindings" : [ {
      "subject" : {
        "type" : "bnode",
        "value" : "service"
      },
      "predicate" : {
        "type" : "uri",
        "value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
      },
      "object" : {
        "type" : "uri",
        "value" : "http://www.w3.org/ns/sparql-service-description#Service"
      }
    }]
  }
}
"""


def test_issue_923():
    with StringIO(RESULT_SOURCE) as result_source:
        Result.parse(
            source=result_source,
            content_type="application/sparql-results+json;charset=utf-8",
        )