Permalink
Browse files

got tests working again, so that they expect URIRef objects instead o…

…f URLs as strings
  • Loading branch information...
1 parent c424a81 commit 2b2eb632a3407bf889d03e1c3dde8657d56c5c6e @edsu committed Aug 2, 2011
Showing with 13 additions and 12 deletions.
  1. +9 −9 example.rdf
  2. +1 −1 setup.py
  3. +3 −2 test.py
View
18 example.rdf
@@ -5,25 +5,25 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<rdf:Description rdf:about="http://www.xyz.edu/~jane">
- <ns1:email rdf:resource="mailto:jane-doe@xyz.edu"/>
- <ns1:address rdf:nodeID="KgpYBTJD2"/>
- <ns1:colleagues rdf:resource="http://www.xyz.edu/students/alicejones.html"/>
- <ns1:colleagues rdf:resource="http://www.xyz.edu/students/bobsmith.html"/>
+ <ns1:image rdf:resource="janedoe.jpg"/>
<ns1:jobTitle>Professor</ns1:jobTitle>
- <ns1:name>Jane Doe</ns1:name>
+ <ns1:email rdf:resource="mailto:jane-doe@xyz.edu"/>
+ <ns1:address rdf:nodeID="cAWDTLlT2"/>
<ns1:url rdf:resource="http://www.janedoe.com"/>
<ns1:telephone>(425) 123-4567</ns1:telephone>
- <ns1:image rdf:resource="janedoe.jpg"/>
<rdf:type rdf:resource="http://schema.org/Person"/>
+ <ns1:colleagues rdf:resource="http://www.xyz.edu/students/alicejones.html"/>
+ <ns1:colleagues rdf:resource="http://www.xyz.edu/students/bobsmith.html"/>
+ <ns1:name>Jane Doe</ns1:name>
</rdf:Description>
- <rdf:Description rdf:nodeID="KgpYBTJD2">
- <ns2:addressLocality>Seattle</ns2:addressLocality>
+ <rdf:Description rdf:nodeID="cAWDTLlT2">
+ <ns2:addressRegion>WA</ns2:addressRegion>
<ns2:postalCode>98052</ns2:postalCode>
<ns2:streetAddress>
20341 Whitworth Institute
405 N. Whitworth
</ns2:streetAddress>
- <ns2:addressRegion>WA</ns2:addressRegion>
+ <ns2:addressLocality>Seattle</ns2:addressLocality>
<rdf:type rdf:resource="http://schema.org/PostalAddress"/>
</rdf:Description>
</rdf:RDF>
View
2 setup.py
@@ -2,7 +2,7 @@
setup(
name = 'rdflib-microdata',
- version = '0.1',
+ version = '0.2.0',
description = "rdflib extension for parsing microdata into an rdf graph",
author = "Ed Summers",
author_email = "ehs@pobox.com",
View
5 test.py
@@ -9,20 +9,21 @@ class MicrodataParserTest(TestCase):
def test_parse(self):
g = Graph()
g.parse(open("example.html"), format="microdata")
+ g.serialize(open("example.rdf", "w"))
# seem to be the right amount of assertions?
self.assertEqual(len(g), 15)
# is there an person?
s = URIRef("http://www.xyz.edu/~jane")
person = Namespace("http://schema.org/Person#")
- self.assertEqual(g.value(s, RDF.type), "http://schema.org/Person")
+ self.assertEqual(g.value(s, RDF.type), URIRef("http://schema.org/Person"))
self.assertEqual(g.value(s, person.telephone), "(425) 123-4567")
# is the person attached to an address?
addr = Namespace("http://schema.org/PostalAddress#")
a = BNode(g.value(s, person.address))
- self.assertEqual(g.value(a, RDF.type), "http://schema.org/PostalAddress")
+ self.assertEqual(g.value(a, RDF.type), URIRef("http://schema.org/PostalAddress"))
self.assertEqual(g.value(a, addr.postalCode), "98052")
# TODO: test dates?

0 comments on commit 2b2eb63

Please sign in to comment.