tests/testthat/test-python-modules.R

context("modules")

test_that("modules can be imported, printed with 'as'", {
  skip_on_cran()
  # previously failed when attempting to print the module
  # https://github.com/rstudio/reticulate/issues/631
  module <- import("time", as = "t")
  expect_output(print(module), "Module(time)", fixed = TRUE)
  expect_true(inherits(module, "python.builtin.module"))
})

Try the reticulate package in your browser

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

reticulate documentation built on Sept. 11, 2024, 8:31 p.m.