Skip to content

Commit 9901c36

Browse files
committed
added a test that makes sure we keeping looking for microdata in children of elements that do not themselves contain microdata
1 parent a42d5b4 commit 9901c36

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

test-data/skip-level.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!doctype html>
2+
<html>
3+
<!-- shamelessly stolen from http://schema.org/Person -->
4+
<head>
5+
<title>skip level</title>
6+
</head>
7+
8+
<body>
9+
<div itemid="http://www.xyz.edu/~jane" itemscope itemtype="http://schema.org/Person">
10+
<p>
11+
<span itemprop="name">Jane Doe</span>
12+
</p>
13+
</div>
14+
</body>
15+
</html>

test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ def test_parse_unlinked(self):
103103
i = items[1]
104104
self.assertEqual(i.itemtype, [URI("http://schema.org/PostalAddress")])
105105
self.assertTrue('Whitworth' in i.streetAddress)
106-
106+
107+
def test_skip_level(self):
108+
items = get_items(open("test-data/skip-level.html"))
109+
self.assertEqual(len(items), 1)
110+
self.assertEqual(items[0].name, "Jane Doe")
111+
112+
107113

108114
if __name__ == "__main__":
109115
unittest.main()

0 commit comments

Comments
 (0)