diff options
author | Karl Lorey <git@karllorey.com> | 2022-06-14 00:20:56 +0200 |
---|---|---|
committer | Karl Lorey <git@karllorey.com> | 2022-06-14 00:20:56 +0200 |
commit | faebafbac0b01a062a93ee143fc82d052b7419c5 (patch) | |
tree | 5b7bee9ab9fd519bce70ab07e4b029c75ca4b061 | |
parent | 73644815b224dc2833995cfdc713dc8f85404efd (diff) |
Use stackoverflow fixture throughout all tests
-rw-r--r-- | tests/test_util.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/test_util.py b/tests/test_util.py index 056764c..bef4758 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -7,15 +7,13 @@ from mlscraper.util import Page class TestPage: - def test_something(self): - with open("tests/static/so.html") as file: - page = Page(file.read()) + def test_something(self, stackoverflow_samples): + page = stackoverflow_samples[0].page nodes = page.select(".answer .js-vote-count") assert [n.text for n in nodes] == ["20", "16", "0"] - def test_find_all(self): - with open("tests/static/so.html") as file: - page = Page(file.read()) + def test_find_all(self, stackoverflow_samples): + page = stackoverflow_samples[0].page nodes = page.find_all("/users/624900/jterrace") assert nodes @@ -38,7 +36,7 @@ def test_extractor_factory(): e2 = get_attribute_extractor("href") assert ( e1 is e2 - ), "extractor factory return different instances for the same extractor" + ), "extractor factory returns different instances for the same extractor" def test_get_root_of_nodes(): |