()
| 45 | |
| 46 | |
| 47 | def test_meta_from_1darray(): |
| 48 | x = np.array([1.0, 2.0, 3.0], dtype=np.float64) |
| 49 | res = _meta_from_array(x) |
| 50 | assert isinstance(res, pd.Series) |
| 51 | assert res.dtype == np.float64 |
| 52 | |
| 53 | x = np.array([1, 2, 3], dtype=np.object_) |
| 54 | res = _meta_from_array(x, columns="x") |
| 55 | assert isinstance(res, pd.Series) |
| 56 | assert res.name == "x" |
| 57 | assert res.dtype == np.object_ |
| 58 | |
| 59 | x = np.array([1, 2, 3], dtype=np.object_) |
| 60 | res = _meta_from_array(x, columns=["x"]) |
| 61 | assert isinstance(res, pd.DataFrame) |
| 62 | assert res["x"].dtype == np.object_ |
| 63 | tm.assert_index_equal(res.columns, pd.Index(["x"])) |
| 64 | |
| 65 | with pytest.raises(ValueError): |
| 66 | _meta_from_array(x, columns=["a", "b"]) |
| 67 | |
| 68 | |
| 69 | def test_meta_from_recarray(): |
nothing calls this directly
no test coverage detected