()
| 1915 | |
| 1916 | |
| 1917 | def test_cast_from_null(): |
| 1918 | in_data = [None] * 3 |
| 1919 | in_type = pa.null() |
| 1920 | out_types = [ |
| 1921 | pa.null(), |
| 1922 | pa.uint8(), |
| 1923 | pa.float16(), |
| 1924 | pa.utf8(), |
| 1925 | pa.binary(), |
| 1926 | pa.binary(10), |
| 1927 | pa.list_(pa.int16()), |
| 1928 | pa.list_(pa.int32(), 4), |
| 1929 | pa.large_list(pa.uint8()), |
| 1930 | pa.decimal128(19, 4), |
| 1931 | pa.timestamp('us'), |
| 1932 | pa.timestamp('us', tz='UTC'), |
| 1933 | pa.timestamp('us', tz='Europe/Paris'), |
| 1934 | pa.duration('us'), |
| 1935 | pa.month_day_nano_interval(), |
| 1936 | pa.struct([pa.field('a', pa.int32()), |
| 1937 | pa.field('b', pa.list_(pa.int8())), |
| 1938 | pa.field('c', pa.string())]), |
| 1939 | pa.dictionary(pa.int32(), pa.string()), |
| 1940 | ] |
| 1941 | for out_type in out_types: |
| 1942 | _check_cast_case((in_data, in_type, in_data, out_type)) |
| 1943 | |
| 1944 | out_types = [ |
| 1945 | |
| 1946 | pa.union([pa.field('a', pa.binary(10)), |
| 1947 | pa.field('b', pa.string())], mode=pa.lib.UnionMode_DENSE), |
| 1948 | pa.union([pa.field('a', pa.binary(10)), |
| 1949 | pa.field('b', pa.string())], mode=pa.lib.UnionMode_SPARSE), |
| 1950 | ] |
| 1951 | in_arr = pa.array(in_data, type=pa.null()) |
| 1952 | for out_type in out_types: |
| 1953 | with pytest.raises(NotImplementedError): |
| 1954 | in_arr.cast(out_type) |
| 1955 | |
| 1956 | |
| 1957 | def test_cast_string_to_number_roundtrip(): |
nothing calls this directly
no test coverage detected