| 5045 | @pytest.mark.parametrize("orient", ["columns", "index"]) |
| 5046 | @pytest.mark.parametrize("npartitions", [2, 5]) |
| 5047 | def test_from_dict(dtype, orient, npartitions): |
| 5048 | data = {"a": range(10), "b": range(10)} |
| 5049 | expected = pd.DataFrame.from_dict(data, dtype=dtype, orient=orient) |
| 5050 | result = dd.DataFrame.from_dict( |
| 5051 | data, npartitions=npartitions, dtype=dtype, orient=orient |
| 5052 | ) |
| 5053 | if orient == "index": |
| 5054 | # DataFrame only has two rows with this orientation |
| 5055 | assert result.npartitions == min(npartitions, 2) |
| 5056 | else: |
| 5057 | assert result.npartitions == npartitions |
| 5058 | assert_eq(result, expected) |
| 5059 | |
| 5060 | |
| 5061 | def test_from_dict_raises(): |