summaryrefslogtreecommitdiff
path: root/test/test_issue363.py
blob: 45f48010a167921f220ace786fd9121ed9b2f5ca (plain)
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
39
40
41
42
43
44
45
import rdflib
from nose import SkipTest
from nose.tools import assert_raises

data = '''<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:http="http://www.w3.org/2011/http#">

    <http:HeaderElement rdf:about="#he0">
        <http:params>
            <http:Parameter rdf:about="#param0_0" />
            <http:Parameter rdf:about="#param0_1" />
        </http:params>
    </http:HeaderElement>

</rdf:RDF>
'''

data2 = '''<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns="http://www.example.org/meeting_organization#">

    <rdf:Description about="http://meetings.example.com/cal#m1">
        <Location rdf:parseType="Resource">
            <zip xmlns="http://www.another.example.org/geographical#">02139</zip>
            <lat xmlns="http://www.another.example.org/geographical#">14.124425</lat>
        </Location>
    </rdf:Description>
</rdf:RDF>
'''

def test_broken_rdfxml():
    #import ipdb; ipdb.set_trace()
    def p():
        rdflib.Graph().parse(data=data)

    assert_raises(Exception, p)

def test_parsetype_resource():
    g = rdflib.Graph().parse(data=data2)
    print g.serialize(format='n3')

if __name__ == '__main__':
    test_broken_rdfxml()
    test_parsetype_resource()