tests/testthat/test-unwrap-python.R

test_that("unwrap_python() works", {
  expect_s3_class(unwrap_python(ln), "python.builtin.module")

  expect_s3_class(unwrap_python(ln$ULabel), "lamindb.models.sqlrecord.Registry")

  df <- data.frame(
    Letters = LETTERS[1:5],
    Numbers = 1:5
  )
  artifact <- ln$Artifact$from_df(df, description = "My data frame")
  expect_s3_class(unwrap_python(artifact), "lamindb.models.artifact.Artifact")
})

test_that("unwrap_args_and_call() works", {
  expect_identical(
    unwrap_args_and_call(
      function(arg, list_arg) {
        c(
          class(arg)[1],
          purrr:::map_chr(list_arg, \(.x) {
            class(.x)[1]
          })
        )
      },
      args = list(
        arg = ln$ULabel,
        list_arg = list(
          ln,
          ln$ULabel
        )
      )
    ),
    c(
      "lamindb.models.sqlrecord.Registry",
      "python.builtin.module",
      "lamindb.models.sqlrecord.Registry"
    )
  )
})

Try the laminr package in your browser

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

laminr documentation built on March 13, 2026, 5:08 p.m.