MCPcopy Create free account
hub / github.com/apache/arrow / test_cast_string_to_number_roundtrip

Function test_cast_string_to_number_roundtrip

python/pyarrow/tests/test_array.py:2072–2085  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2070
2071
2072def test_cast_string_to_number_roundtrip():
2073 cases = [
2074 (pa.array(["1", "127", "-128"]),
2075 pa.array([1, 127, -128], type=pa.int8())),
2076 (pa.array([None, "18446744073709551615"]),
2077 pa.array([None, 18446744073709551615], type=pa.uint64())),
2078 ]
2079 for in_arr, expected in cases:
2080 casted = in_arr.cast(expected.type, safe=True)
2081 casted.validate(full=True)
2082 assert casted.equals(expected)
2083 casted_back = casted.cast(in_arr.type, safe=True)
2084 casted_back.validate(full=True)
2085 assert casted_back.equals(in_arr)
2086
2087
2088def test_cast_dictionary():

Callers

nothing calls this directly

Calls 4

equalsMethod · 0.80
arrayMethod · 0.45
castMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected