Beispiel #1
0
def test_maybe_coerce_to_str_minimal_str_dtype():

    a = np.array(["a", "a_long_string"])
    index = pd.Index(["a"])

    actual = utils.maybe_coerce_to_str(index, [a])
    expected = np.array("a")

    assert_array_equal(expected, actual)
    assert expected.dtype == actual.dtype
Beispiel #2
0
def test_maybe_coerce_to_str(a, b, expected):

    a = np.array([a])
    b = np.array([b])
    index = pd.Index(a).append(pd.Index(b))

    actual = utils.maybe_coerce_to_str(index, [a, b])

    assert_array_equal(expected, actual)
    assert expected.dtype == actual.dtype