Skip to content

Commit

Permalink
Style code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Eagles committed Oct 13, 2023
1 parent 15ef846 commit 53f9778
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/test-job_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ test_that(

job_df <- job_info(user = Sys.getenv("USER"), partition = "shared")
expect_equal(unique(job_df$user), Sys.getenv("USER"))

# We specified just one partition, but there should be many levels to
# the factor
expect_equal(as.character(unique(job_df$partition)), 'shared')
expect_equal(as.character(unique(job_df$partition)), "shared")
expect_equal(nlevels(job_df$partition) > 1, TRUE)
}
)
20 changes: 10 additions & 10 deletions tests/testthat/test-partition_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test_that(

part_df <- partition_info(partition = NULL, all_nodes = FALSE)

# No values should be NA
# No values should be NA
expect_equal(any(is.na(part_df)), FALSE)

# There should be more than one partition in the testing environment
Expand All @@ -27,7 +27,7 @@ test_that(
actual_types <- part_df |>
summarize_all(class) |>
as.character()

expect_equal(expected_types, actual_types)
}
)
Expand All @@ -40,31 +40,31 @@ test_that(

part_df <- partition_info(partition = "shared", all_nodes = TRUE)

# No values should be NA
# No values should be NA
expect_equal(any(is.na(part_df)), FALSE)

# We specified just one partition, but there should be many levels to
# the factor
expect_equal(as.character(unique(part_df$partition)), 'shared')
expect_equal(as.character(unique(part_df$partition)), "shared")
expect_equal(nlevels(part_df$partition) > 1, TRUE)

# The 'shared' partition has many compute nodes (on the local test
# environment)
expect_equal(nrow(part_df) > 1, TRUE)

# Compare expected vs. actual data types for each expected column
expected_types = c(
partition = 'factor', node = 'character', free_mem_gb = 'numeric',
alloc_mem_gb = 'numeric', total_mem_gb = 'numeric',
state = 'factor', alloc_cpus = 'integer', inactive_cpus = 'integer',
other_cpus = 'integer', total_cpus = 'integer'
expected_types <- c(
partition = "factor", node = "character", free_mem_gb = "numeric",
alloc_mem_gb = "numeric", total_mem_gb = "numeric",
state = "factor", alloc_cpus = "integer", inactive_cpus = "integer",
other_cpus = "integer", total_cpus = "integer"
)
expected_types <- unname(expected_types[colnames(part_df)])

actual_types <- part_df |>
summarize_all(class) |>
as.character()

expect_equal(expected_types, actual_types)
}
)

0 comments on commit 53f9778

Please sign in to comment.