tests/testthat/test-BlockWorker.R

test_that("BlockWorker", {
  skip_if_not(CheckAWSKeys())

  # Test block
  expect_type(BlockWorker("A3LXJ76P1ZZPMC", reasons = "Did not follow instructions"), "list")
  expect_type(BlockWorker(as.factor("A3LXJ76P1ZZPMC"),
                          reasons = as.factor("Did not follow instructions")), "list")

  # Multiple workers
  expect_type(BlockWorker(c("A3LXJ76P1ZZPMC", "A3LXJ76P1ZZPMC"),
                          reasons = "Did not follow instructions"), "list")

  # Incorrect number of reasons
  expect_s3_class(try(BlockWorker("A3LXJ76P1ZZPMC",
                          reasons = c("reason1", "reason2")), TRUE), "try-error")

  # Unblock
  UnblockWorker("A3LXJ76P1ZZPMC")
})

Try the pyMTurkR package in your browser

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

pyMTurkR documentation built on Nov. 25, 2021, 9:07 a.m.