diff --git a/pandas_ods_reader/tests/rsc/mixed_dtypes.ods b/pandas_ods_reader/tests/rsc/mixed_dtypes.ods new file mode 100644 index 0000000..4be87f4 Binary files /dev/null and b/pandas_ods_reader/tests/rsc/mixed_dtypes.ods differ diff --git a/pandas_ods_reader/tests/test_read_ods.py b/pandas_ods_reader/tests/test_read_ods.py index 245aa09..cbe4f51 100644 --- a/pandas_ods_reader/tests/test_read_ods.py +++ b/pandas_ods_reader/tests/test_read_ods.py @@ -14,6 +14,7 @@ no_header_file = "example_no_headers.ods" duplicated_column_names_file = "example_duplicated_column_names.ods" col_len_file = "example_col_lengths.ods" missing_header_file = "example_missing_header.ods" +mixed_dtypes_file = "mixed_dtypes.ods" class TestOdsReader(object): @@ -88,3 +89,15 @@ class TestOdsReader(object): assert len(df) == 10 assert (len(df.columns) == 5) assert df.columns[2] == "unnamed.1" + + def test_mixed_dtypes(sefl): + path = os.path.join(rsc, mixed_dtypes_file) + df = read_ods(path, 1) + assert isinstance(df, pd.DataFrame) + assert len(df) == 10 + assert (len(df.columns) == 5) + + type_list = [float, object, float, float, object] + assert df.dtypes.tolist() == type_list + col_b_types = [type(v) for v in df.B.values] + assert str in col_b_types and float in col_b_types