Commits

Barnaby Walters committed 98d07bb

Added tests for microformat nested under multiple property names, three levels of nesting, failing test for plain child microformat

  • Participants
  • Parent commits a0d3d00

Comments (0)

Files changed (2)

File test/examples/nested_multiple_classnames.html

 	<article class="h-entry h-as-note">
         <h1 class="p-name">A BLOG POST</h1>
         
-		<p class="p-author h-card">
+		<p class="p-author p-reviewer h-card">
 			<span class="p-name">Tom Morris</span>
 			<a href="http://tommorris.org/" class="u-url">tommorris.org</a>
+            <p class="p-adr h-adr">
+                <span class="p-city">London</span>
+            </p>
 		</p>
+        
+        <p class="h-cite">Some Citation</p>
 	</article>
 </body>
 </html>

File test/test_parser.py

     assert len(result["items"]) == 1
     assert "author" in result["items"][0]["properties"]
     assert result["items"][0]["properties"]["author"][0]["properties"]["name"][0] == "Tom Morris"
+    assert result["items"][0]["properties"]["reviewer"][0]["properties"]["name"][0] == "Tom Morris"
+    assert result["items"][0]["properties"]["author"][0]["properties"]["adr"][0]["properties"]["city"][0] == "London"
+
+def test_plain_child_microformat():
+    result = parse_fixture("nested_multiple_classnames.html")
+    
+    assert len(result["items"]) == 1
+    assert "children" in result["items"][0]
+    assert len(result["items"][0]["children"]) == 1
+    assert result["items"][0]["children"]["properties"]["name"][0] == "Some Citation"
 
 def test_implied_name():
     result = parse_fixture("implied_properties.html")