Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

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

0 notes on commit 2b2eb63

Please sign in to comment.
Something went wrong with that request. Please try again.