(dtype: Any)
| 1000 | |
| 1001 | @pytest.mark.parametrize("dtype", [np.int64, np.float64]) |
| 1002 | def test_flatten(dtype: Any): |
| 1003 | df = pd.DataFrame( |
| 1004 | { |
| 1005 | "array": [ |
| 1006 | np.array([1, 2], dtype=dtype), |
| 1007 | np.array([], dtype=dtype), |
| 1008 | np.array([3, 4], dtype=dtype), |
| 1009 | np.array([10, 11, 12], dtype=dtype), |
| 1010 | np.array([4, 5, 6, 1, 2], dtype=dtype), |
| 1011 | ], |
| 1012 | "other": [-1, -2, -3, -4, -5], |
| 1013 | } |
| 1014 | ) |
| 1015 | expected_df = pd.DataFrame( |
| 1016 | { |
| 1017 | "array": np.array([1, 2, 3, 4, 10, 11, 12, 4, 5, 6, 1, 2], dtype=dtype), |
| 1018 | "other": [-1, -1, -3, -3, -4, -4, -4, -5, -5, -5, -5, -5], |
| 1019 | } |
| 1020 | ) |
| 1021 | t1 = table_from_pandas(df) |
| 1022 | t1 = t1.flatten(t1.array) |
| 1023 | expected = table_from_pandas(expected_df) |
| 1024 | assert_table_equality_wo_index(t1, expected) |
| 1025 | |
| 1026 | |
| 1027 | @pytest.mark.parametrize("dtype", [np.int64, np.float64]) |
nothing calls this directly
no test coverage detected