mirror of
https://github.com/kennethreitz/requests-html.git
synced 2026-06-05 23:00:20 +00:00
+3
-2
@@ -302,8 +302,9 @@ class Element(BaseParser):
|
||||
attrs = {k: v for k, v in self.element.items()}
|
||||
|
||||
# Split class up, as there are ussually many of them:
|
||||
if 'class' in attrs:
|
||||
attrs['class'] = tuple(attrs['class'].split())
|
||||
for attr in ['class']:
|
||||
if attr in attrs:
|
||||
attrs[attr] = tuple(attrs[attr].split())
|
||||
|
||||
return attrs
|
||||
|
||||
|
||||
@@ -21,6 +21,14 @@ def test_file_get():
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
@pytest.mark.ok
|
||||
def test_class_seperation():
|
||||
r = get()
|
||||
|
||||
about = r.html.find('#about', first=True)
|
||||
assert len(about.attrs['class']) == 2
|
||||
|
||||
|
||||
@pytest.mark.ok
|
||||
def test_css_selector():
|
||||
r = get()
|
||||
@@ -151,4 +159,4 @@ def test_bare_js_eval():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_anchor_links()
|
||||
test_class_seperation()
|
||||
|
||||
Reference in New Issue
Block a user