Skip to content

Commit

Permalink
test: add minimal example_1 test module
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed Nov 28, 2023
1 parent 4b40dbf commit 89a95fe
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/dataset/sarscov2/phylogeny.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,20 +301,8 @@ pub fn compress_lineage(
///
/// # Arguments
///
/// * `lineage` | `String` | A String of a SARS-CoV-2 lineage name.
/// * `alias_key` | `&BTreeMap<String, Vec<String>>` | A mapping of SARS-CoV-2 aliases to decompressed lineage paths.
///
/// # Basic usage:
///
/// ```
/// decompress_lineage("BA.5.2", alias_key)?;
/// ```
///
/// # Example
///
/// ```no run
/// let alias_key = import_alias_key(".")?;
/// decompress_lineage("BA.5.2", alias_key)?;
/// * `lineage` | A string slice that contains a SARS-CoV-2 lineage name.
/// * `alias_key` | A mapping of SARS-CoV-2 aliases to decompressed lineage paths.
/// ```
pub fn decompress_lineage(
lineage: &str,
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ pub mod phylogeny;
pub mod plot;
pub mod recombination;
pub mod sequence;
#[cfg(test)]
pub mod test;
pub mod utils;

use crate::dataset::attributes::Name;
Expand Down
47 changes: 47 additions & 0 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use crate::cli;
use crate::dataset::attributes::{Name, Tag};
use crate::dataset::download;
use color_eyre::eyre::{Report, Result};
use std::path::PathBuf;
use std::str::FromStr;

#[tokio::test]
async fn example_1() -> Result<(), Report> {
// ------------------------------------------------------------------------
// Dataset Download

let name = Name::SarsCov2;
let tag = Tag::from_str("2023-11-17")?;
let output_dir = PathBuf::from("test").join("example_1").join("dataset");
let summary = None;

let mut args = cli::dataset::download::Args {
name,
tag,
output_dir: output_dir.clone(),
summary,
};

download::dataset(&mut args).await?;

// // ------------------------------------------------------------------------
// // Run

// let population = Some("AY.4.2*,BA.5.2,XBC.1.6*,XBB.1.5.1,XBL".to_string());
// let dataset_dir = output_dir;
// let output_dir = PathBuf::from("test").join("example_1").join("run");

// let mut args = cli::run::Args {
// population,
// dataset_dir: dataset_dir.clone(),
// output_dir: output_dir.clone(),
// ..Default::default()
// };

// run(&mut args)?;

// ------------------------------------------------------------------------
// Plot

Ok(())
}

0 comments on commit 89a95fe

Please sign in to comment.