Read HTML file from formats data directory. Parameters ---------- datapath : pytest fixture The datapath fixture injected into a test by pytest. name : str The name of the HTML file without the suffix. Returns ------- str : contents of HTML file.
(datapath, name)
| 30 | |
| 31 | |
| 32 | def expected_html(datapath, name): |
| 33 | """ |
| 34 | Read HTML file from formats data directory. |
| 35 | |
| 36 | Parameters |
| 37 | ---------- |
| 38 | datapath : pytest fixture |
| 39 | The datapath fixture injected into a test by pytest. |
| 40 | name : str |
| 41 | The name of the HTML file without the suffix. |
| 42 | |
| 43 | Returns |
| 44 | ------- |
| 45 | str : contents of HTML file. |
| 46 | """ |
| 47 | filename = ".".join([name, "html"]) |
| 48 | filepath = datapath("io", "formats", "data", "html", filename) |
| 49 | with open(filepath, encoding="utf-8") as f: |
| 50 | html = f.read() |
| 51 | return html.rstrip() |
| 52 | |
| 53 | |
| 54 | @pytest.fixture(params=["mixed", "empty"]) |
no test coverage detected