aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2017-07-05 23:23:35 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2017-07-05 23:27:12 +0800
commit609ff8ca19f1c4c168a81121074b91cc0f0d4c47 (patch)
treeb2563ed9960c812ca25f93bb4b08cff64a9e2a49 /test
parentb6c9fe416243373bcb59eb8aa5ef0baca8f3c97c (diff)
[utils] Support attributes with no values in get_elements_by_attribute()
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 2b93b3604..30738e7cf 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -1228,6 +1228,12 @@ part 3</font></u>
self.assertEqual(get_element_by_attribute('class', 'foo', html), None)
self.assertEqual(get_element_by_attribute('class', 'no-such-foo', html), None)
+ html = '''
+ <div itemprop="author" itemscope>foo</div>
+ '''
+
+ self.assertEqual(get_element_by_attribute('itemprop', 'author', html), 'foo')
+
def test_get_elements_by_class(self):
html = '''
<span class="foo bar">nice</span><span class="foo bar">also nice</span>