Skip to content

Commit

Permalink
add test that asserts utf8 fields if no inference of schema is done i…
Browse files Browse the repository at this point in the history
…n csv
  • Loading branch information
ritchie46 committed Nov 16, 2021
1 parent fb361c4 commit 4ac3ec9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions polars/polars-io/src/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1290,4 +1290,24 @@ A3,\"B4_\"\"with_embedded_double_quotes\"\"\",C4,4";

Ok(())
}

#[test]
fn test_infer_schema_0_rows() -> Result<()> {
let csv = r#"a,b,c,d
1,a,1.0,true
1,a,1.0,false
"#;
let file = Cursor::new(csv);
let df = CsvReader::new(file).infer_schema(Some(0)).finish()?;
assert_eq!(
df.dtypes(),
&[
DataType::Utf8,
DataType::Utf8,
DataType::Utf8,
DataType::Utf8
]
);
Ok(())
}
}

0 comments on commit 4ac3ec9

Please sign in to comment.