tests/testthat/test-antaresDataTableMethods.R

#Copyright © 2016 RTE Réseau de transport d’électricité

context("Object antaresDataTable")

l <- list.files()

sapply(studyPathS, function(studyPath){
  

opts <- setSimulationPath(studyPath)

mydata <- readAntares(areas = "all", showProgress = FALSE)

test_that("subsetting an antaresDataTable returns an antaresDataTable", {
  subsetdt <- mydata[area == "a"]
  expect_is(subsetdt, "antaresDataTable")
  expect_true(all(c("timeStep", "opts", "synthesis", "type") %in% names(attributes(subsetdt))))
})

test_that("modifying columns of an antaresDataTable returns an antaresDataTable", {
  newdata <- copy(mydata)
  newdata[, load2 <- LOAD * 2]
  newdata[, LOAD := NULL]
  expect_is(newdata, "antaresDataTable")
  expect_true(all(c("timeStep", "opts", "synthesis", "type") %in% names(attributes(newdata))))
})

test_that("merge an antaresDataTable with a table returns an antaresDataTable", {
  newdata <- merge(mydata, opts$districtsDef, by = "area")
  expect_is(newdata, "antaresDataTable")
  expect_true(all(c("timeStep", "opts", "synthesis", "type") %in% names(attributes(newdata))))
})
})

Try the antaresRead package in your browser

Any scripts or data that you put into this service are public.

antaresRead documentation built on Aug. 31, 2023, 1:09 a.m.