Skip to content

Commit

Permalink
Increase readability of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Oct 25, 2023
1 parent 3a88079 commit 8dbc83b
Showing 1 changed file with 100 additions and 52 deletions.
152 changes: 100 additions & 52 deletions tests/test_utils_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,138 +702,170 @@ def test_concat(objs, overwrite, expected):
(
[
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
],
None,
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
),
(
[
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
],
np.sum,
pd.DataFrame(
[[2, 4], [6, 8]],
{
'A': [2, 6],
'B': [4, 8],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
),
(
[
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
pd.DataFrame(
[1, 3],
{
'A': [1, 3],
},
pd.Index(['a', 'b']),
columns=['A'],
dtype='float',
),
],
np.sum,
pd.DataFrame(
[[2, 2], [6, 4]],
{
'A': [2, 6],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
),
(
[
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
pd.DataFrame(
[2, 4],
{
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['B'],
dtype='float',
),
],
np.sum,
pd.DataFrame(
[[1, 4], [3, 8]],
{
'A': [1, 3],
'B': [4, 8],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
),
(
[
pd.DataFrame(
[1, 3],
{
'A': [1, 3],
},
pd.Index(['a', 'b']),
columns=['A'],
dtype='float',
),
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
],
np.sum,
pd.DataFrame(
[[2, 2], [6, 4]],
{
'A': [2, 6],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
),
(
[
pd.DataFrame(
[2, 4],
{
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['B'],
dtype='float',
),
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
],
np.sum,
pd.DataFrame(
[[4, 1], [8, 3]],
{
'B': [4, 8],
'A': [1, 3],
},
pd.Index(['a', 'b']),
columns=['B', 'A'],
dtype='float',
),
),
Expand Down Expand Up @@ -921,15 +953,19 @@ def test_concat(objs, overwrite, expected):
pytest.param(
[
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
pd.DataFrame(
[[2, 3], [4, 5]],
{
'A': [2, 4],
'B': [3, 5],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
],
Expand All @@ -940,46 +976,58 @@ def test_concat(objs, overwrite, expected):
(
[
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
pd.DataFrame(
[[2, 3], [4, 5]],
{
'A': [2, 4],
'B': [3, 5],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
],
np.sum,
pd.DataFrame(
[[3, 5], [7, 9]],
{
'A': [3, 7],
'B': [5, 9],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
),
(
[
pd.DataFrame(
[[1, 2], [3, 4]],
{
'A': [1, 3],
'B': [2, 4],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
pd.DataFrame(
[[2, 3], [4, 5]],
{
'A': [2, 4],
'B': [3, 5],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
],
lambda x: x[1],
pd.DataFrame(
[[2, 3], [4, 5]],
{
'A': [2, 4],
'B': [3, 5],
},
pd.Index(['a', 'b']),
columns=['A', 'B'],
dtype='float',
),
),
Expand Down

0 comments on commit 8dbc83b

Please sign in to comment.