Skip to content

CLN: io/formats/html.py: refactor #22726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 18, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tests from gh-22655 (not merged)
  • Loading branch information
simonjayhawkins committed Sep 17, 2018
commit a7db256516e47df48b79d100de7e3cd4f3e8ac0a
12 changes: 12 additions & 0 deletions pandas/tests/io/formats/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest


@pytest.fixture
def read_file(datapath):
"""fixture factory to read text files from tests/io/formats/data"""
def _read_file(filename):
filepath = datapath('io', 'formats', 'data', filename)
with open(filepath) as f:
contents = f.read()
return contents
return _read_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<table border="1" class="dataframe">
<thead>
<tr>
<th></th>
<th>columns.name.0</th>
<th colspan="2" halign="left">a</th>
</tr>
<tr>
<th></th>
<th>columns.name.1</th>
<th>b</th>
<th>c</th>
</tr>
<tr>
<th>index.name.0</th>
<th>index.name.1</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="2" valign="top">a</th>
<th>b</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>c</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>columns.name</th>
<th>0</th>
<th>1</th>
</tr>
<tr>
<th>index.name.0</th>
<th>index.name.1</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="2" valign="top">a</th>
<th>b</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>c</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<table border="1" class="dataframe">
<thead>
<tr>
<th></th>
<th></th>
<th colspan="2" halign="left">a</th>
</tr>
<tr>
<th></th>
<th></th>
<th>b</th>
<th>c</th>
</tr>
<tr>
<th>index.name.0</th>
<th>index.name.1</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="2" valign="top">a</th>
<th>b</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>c</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th></th>
<th>0</th>
<th>1</th>
</tr>
<tr>
<th>index.name.0</th>
<th>index.name.1</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="2" valign="top">a</th>
<th>b</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>c</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<table border="1" class="dataframe">
<thead>
<tr>
<th>columns.name.0</th>
<th colspan="2" halign="left">a</th>
</tr>
<tr>
<th>columns.name.1</th>
<th>b</th>
<th>c</th>
</tr>
<tr>
<th>index.name</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>columns.name</th>
<th>0</th>
<th>1</th>
</tr>
<tr>
<th>index.name</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<table border="1" class="dataframe">
<thead>
<tr>
<th></th>
<th colspan="2" halign="left">a</th>
</tr>
<tr>
<th></th>
<th>b</th>
<th>c</th>
</tr>
<tr>
<th>index.name</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>0</th>
<th>1</th>
</tr>
<tr>
<th>index.name</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
25 changes: 25 additions & 0 deletions pandas/tests/io/formats/data/index_none_columns_named_multi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<table border="1" class="dataframe">
<thead>
<tr>
<th>columns.name.0</th>
<th colspan="2" halign="left">a</th>
</tr>
<tr>
<th>columns.name.1</th>
<th>b</th>
<th>c</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td></td>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>columns.name</th>
<th>0</th>
<th>1</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td></td>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
12 changes: 12 additions & 0 deletions pandas/tests/io/formats/data/index_none_columns_none.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<table border="1" class="dataframe">
<tbody>
<tr>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
21 changes: 21 additions & 0 deletions pandas/tests/io/formats/data/index_none_columns_unnamed_multi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<table border="1" class="dataframe">
<thead>
<tr>
<th colspan="2" halign="left">a</th>
</tr>
<tr>
<th>b</th>
<th>c</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>0</th>
<th>1</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<table border="1" class="dataframe">
<thead>
<tr>
<th></th>
<th>columns.name.0</th>
<th colspan="2" halign="left">a</th>
</tr>
<tr>
<th></th>
<th>columns.name.1</th>
<th>b</th>
<th>c</th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="2" valign="top">a</th>
<th>b</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>c</th>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Loading