tests/testthat/test-utils.R

test_that("bind_context works for more complicated classes", {

  x <- R6::R6Class("hello",public = list(get_x = function() ctx$x))
  y <- R6::R6Class(inherit = x)

  instance <- y$new()
  ctx <- context$new(TRUE, list(), list(), training = FALSE)
  bind_context(instance, ctx)

  expect_equal(instance$get_x(), ctx$x)
})
mlverse/torchlight documentation built on Sept. 19, 2024, 11:22 p.m.