Skip to content

Commit

Permalink
Merge pull request #16 from Open-Systems-Pharmacology/getbaseunit-par…
Browse files Browse the repository at this point in the history
…ameter-fix

Remove `dimension` parameter in `ospsuite::getBaseUnit`
  • Loading branch information
abdullahhamadeh authored Nov 20, 2024
2 parents 383f636 + 3938332 commit 1d3e336
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/output.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SAOutput <- R6::R6Class(

self$dimension <- ospQuantity$dimension

self$unit <- unit %||% ospsuite::getBaseUnit(dimension = self$dimension)
self$unit <- unit %||% ospsuite::getBaseUnit(self$dimension)

if (self$unit == "Unitless") {
self$unit <- ""
Expand Down
2 changes: 1 addition & 1 deletion R/parameter.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SAParameter <- R6::R6Class(

self$dimension <- ospParameter$dimension

self$unit <- unit %||% ospsuite::getBaseUnit(dimension = self$dimension)
self$unit <- unit %||% ospsuite::getBaseUnit(self$dimension)

if (self$unit == "Unitless") {
self$unit <- ""
Expand Down
17 changes: 17 additions & 0 deletions tests/testthat/test-SAOutput.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite")
simulation <- loadSimulation(simPath)
outputPath <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
parameterPath <- c("Aciclovir|Lipophilicity")

test_that("SAOutput object can be created with default settings", {
expect_no_error(
SAOutputTest <- SAOutput$new(
simulation = simulation,
path = outputPath
)
)
expect_s3_class(SAOutputTest, "R6")
expect_equal(SAOutputTest$path, outputPath)
expect_equal(SAOutputTest$displayName, outputPath)
expect_null(SAOutputTest$pkParameterList)
})
16 changes: 16 additions & 0 deletions tests/testthat/test-SAParameter.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite")
simulation <- loadSimulation(simPath)
parameterPath <- c("Aciclovir|Lipophilicity")

test_that("SAParameter object can be created with default settings", {
expect_no_error(
SAParameterTest <- SAParameter$new(
simulation = simulation,
path = parameterPath
)
)
expect_s3_class(SAParameterTest, "R6")
expect_equal(SAParameterTest$path, parameterPath)
expect_equal(SAParameterTest$displayName, parameterPath)
expect_equal(SAParameterTest$unit, "Log Units")
})
5 changes: 0 additions & 5 deletions tests/testthat/test-XXX.R

This file was deleted.

0 comments on commit 1d3e336

Please sign in to comment.