better tests

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2018-03-03 08:27:02 -05:00
parent 6e1938e588
commit 90d9bbbc0f
2 changed files with 12 additions and 3 deletions
+3 -2
View File
@@ -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
+9 -1
View File
@@ -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()