Skip to content

Commit

Permalink
fix: failing tests in data::io
Browse files Browse the repository at this point in the history
  • Loading branch information
avhz authored and avhz committed Oct 28, 2024
1 parent 8c6bcc1 commit 82ae674
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
File renamed without changes.
15 changes: 9 additions & 6 deletions crates/RustQuant_data/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,20 @@ impl DataScanner for Data {
mod test_io {
use super::*;

const READ_PATH: &str = "./src/examples/read";
const WRITE_PATH: &str = "./src/examples/write";

#[test]
fn test_read_write_csv() -> Result<(), RustQuantError> {
let mut data = Data {
format: DataFormat::CSV,
path: String::from("./src/data/examples/example.csv"),
path: format!("{}.csv", READ_PATH), //String::from("./examples/example.csv"),
data: DataFrame::default(),
};

data.read()?;

data.path = String::from("./src/data/examples/write.csv");
data.path = format!("{}.csv", WRITE_PATH); //String::from("./examples/write.csv");

data.write()?;

Expand All @@ -182,13 +185,13 @@ mod test_io {
fn test_read_write_json() -> Result<(), RustQuantError> {
let mut data = Data {
format: DataFormat::JSON,
path: String::from("./src/data/examples/example.json"),
path: format!("{}.json", READ_PATH),
data: DataFrame::default(),
};

data.read()?;

data.path = String::from("./src/data/examples/write.json");
data.path = format!("{}.json", WRITE_PATH);

data.write()?;

Expand All @@ -201,13 +204,13 @@ mod test_io {
fn test_read_write_parquet() -> Result<(), RustQuantError> {
let mut data = Data {
format: DataFormat::PARQUET,
path: String::from("./src/data/examples/example.parquet"),
path: format!("{}.parquet", READ_PATH),
data: DataFrame::default(),
};

data.read()?;

data.path = String::from("./src/data/examples/write.parquet");
data.path = format!("{}.parquet", WRITE_PATH);

data.write()?;

Expand Down

0 comments on commit 82ae674

Please sign in to comment.