MCPcopy Create free account
hub / github.com/datapane/datapane / test_to_str

Function test_to_str

python-client/tests/common/test_df_processor.py:140–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138
139
140def test_to_str():
141 data = pd.DataFrame(
142 dict(
143 int_col=[x for x in range(32)],
144 obj_col=[(str(x), str(x)) for x in range(30)] + [pd.NA, pd.NA],
145 cat_obj_col=[("a", "b") for x in range(30)] + [pd.NA, pd.NA],
146 )
147 )
148
149 data1 = data.copy(deep=True)
150 obj_to_str(data1)
151 _check_is_string(data1, ["obj_col", "cat_obj_col"])
152
153 data2 = data.copy(deep=True)
154 parse_categories(data2)
155 obj_to_str(data2)
156 _check_is_string(data2, ["obj_col"])
157 assert type(data2["cat_obj_col"].cat.categories[0]) == str
158
159
160def test_col_order(tmp_path: Path):

Callers

nothing calls this directly

Calls 4

obj_to_strFunction · 0.90
parse_categoriesFunction · 0.90
_check_is_stringFunction · 0.85
copyMethod · 0.45

Tested by

no test coverage detected