Skip to content

Commit 9c3f352

Browse files
committed
change tests & conftest
1 parent 87231e0 commit 9c3f352

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

protocol/tests/conftest.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pytest
22
import pandas as pd
3-
from pandas.api.exchange.implementation import _from_dataframe
43

54

65
@pytest.fixture(scope="package")
@@ -10,11 +9,3 @@ def maker(dct, is_categorical=False):
109
return df.astype("category") if is_categorical else df
1110

1211
return maker
13-
14-
15-
@pytest.fixture(scope="package")
16-
def df_from_xchg():
17-
def maker(xchg):
18-
return _from_dataframe(xchg)
19-
20-
return maker

protocol/tests/test_protocol.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_float_int(df_from_dict):
3636
}
3737
)
3838
dfX = df.__dataframe__()
39-
columns = {"a": 0, "b": 0, "c": 2, "d": 0, "e": 20, "f": 21}
39+
columns = [INT, INT, FLOAT, INT, BOOL, STRING]
4040

4141
for column, kind in columns.items():
4242
colX = dfX.get_column_by_name(column)
@@ -46,8 +46,6 @@ def test_float_int(df_from_dict):
4646

4747
assert colX.dtype[0] == kind
4848

49-
assert dfX.get_column_by_name("c").dtype[1] == 64
50-
5149

5250
def test_na_float(df_from_dict):
5351
df = df_from_dict({"a": [1.0, math.nan, 2.0]})
@@ -85,10 +83,10 @@ def test_dataframe(df_from_dict):
8583
assert dfX.num_columns() == 3
8684
assert dfX.num_rows() == 3
8785
assert dfX.num_chunks() == 1
88-
assert dfX.column_names() == ["x", "y", "z"]
86+
assert list(dfX.column_names()) == ["x", "y", "z"]
8987
assert (
90-
dfX.select_columns((0, 2)).column_names()
91-
== dfX.select_columns_by_name(("x", "z")).column_names()
88+
list(dfX.select_columns((0, 2)).column_names())
89+
== list(dfX.select_columns_by_name(("x", "z")).column_names())
9290
)
9391

9492

@@ -116,8 +114,8 @@ def test_get_columns(df_from_dict):
116114
for colX in dfX.get_columns():
117115
assert colX.size == 2
118116
assert colX.num_chunks() == 1
119-
assert dfX.get_column(0).dtype[0] == 0
120-
assert dfX.get_column(1).dtype[0] == 2
117+
assert dfX.get_column(0).dtype[0] == INT
118+
assert dfX.get_column(1).dtype[0] == FLOAT
121119

122120

123121
def test_buffer(df_from_dict):

0 commit comments

Comments
 (0)