1library(pystr)
2context("pystr_maketrans")
3
4test_that("it throws error if x and y are inequal lengths", {
5  expect_error(pystr_maketrans("abc", "1234"))
6})
7
8test_that("it works with numerics as keys", {
9  expect_equal(pystr_maketrans("123", "abc"), list("1"="a", "2"="b", "3"="c"))
10})
11
12test_that("it works with chars as keys", {
13  expect_equal(pystr_maketrans("abc", "123"), list(a="1", b="2", c="3"))
14})
15
16test_that("it works with a combination of numerics and chars as keys", {
17  expect_equal(pystr_maketrans("1a", "xy"), list("1"="x", a="y"))
18})
19