1library(pystr)
2context("pystr_isalnum")
3
4test_that("it returns true if all characters are alphabetic or numeric", {
5  expect_true(pystr_isalnum("abc123"))
6})
7
8test_that("it returns false if not all characters are alphabetic or numeric", {
9  expect_false(pystr_isalnum("abc123!"))
10})
11
12test_that("it works with a vector of strings", {
13  expect_equal(pystr_isalnum(c("one", "2", "three!")), c(TRUE, TRUE, FALSE))
14})
15
16test_that("it works with NAs", {
17  expect_equal(pystr_isalnum(c("one", "2", NA)), c(TRUE, TRUE, NA))
18})
19