小编Sat*_*idi的帖子

错误:“ansi_hyperlink_types”不是从“namespace:cli”导出的对象

我正在基于此探索 R 中的单元测试。

因此,我安装了该testthat软件包并编写了一个简单的函数和一个测试,如上面的链接中所述。这是代码

library(testthat)

f_to_c <- function(F_temp){
  C_temp <- (F_temp - 32) * 5/9
  return(C_temp)
}

#test
test_that(desc = "Fahrenheit to Celsius", code = {
  
  temp <- f_to_c(50)
  expect_that( object = temp, condition = equals(10) )
  expect_that( object = is.numeric(temp), condition = equals(TRUE) )
})
Run Code Online (Sandbox Code Playgroud)

这是我得到的

Error: 'ansi_hyperlink_types' is not an exported object from 'namespace:cli'
Run Code Online (Sandbox Code Playgroud)

导致此错误的原因可能是什么以及如何解决此问题?或者,是否有其他方法在 R 中运行测试?提前致谢。

testing unit-testing r testthat

1
推荐指数
1
解决办法
891
查看次数

标签 统计

r ×1

testing ×1

testthat ×1

unit-testing ×1