# -*- coding: utf-8 -*- from rdflib.graph import ConjunctiveGraph from rdflib.parser import StringInputSource import textwrap prefix = textwrap.dedent('''\ @prefix nie: . @prefix nfo: . @prefix nco: . @prefix nmo: . @prefix ncal: . @prefix nexif: . @prefix nid3: . @prefix dc: . @prefix nmm: . @prefix nao: . ''') meta = textwrap.dedent(u"""\ a nfo:PaginatedTextDocument ; nie:title "SV Meldung" ; nco:creator [ a nco:Contact ; nco:fullname "nikratio"] ; nie:contentCreated "2011-08-10T20:12:38Z" ; dc:format "application/pdf" ; nie:description "()" ; nao:hasTag ?tag1 ; nfo:pageCount 1 ; nie:plainTextContent "%s" . } } WHERE { { ?tag1 a nao:Tag ; nao:prefLabel "()" . """) test_string1 = u"""\ Betriebsnummer der Einzugsstelle:\nKnappschaft\n980 0000 6\nWICHTIGES DOKUMENT - SORGFÄLTIG AUFBEWAHREN!\n """ def test1(): meta1 = meta.encode('utf-8') % test_string1.encode('utf-8') graph = ConjunctiveGraph() graph.parse(StringInputSource(prefix + '' + meta1), format='n3') test_string2 = u"""\ Betriebsnummer der Einzugsstelle: Knappschaft 980 0000 6 WICHTIGES DOKUMENT - SORGFÄLTIG AUFBEWAHREN! """ def test2(): meta2 = meta.encode('utf-8') % test_string2.encode('utf-8') graph = ConjunctiveGraph() graph.parse(StringInputSource(prefix + '' + meta2), format='n3') from nose import SkipTest raise SkipTest("Known issue, with newlines in text")