()
| 1949 | |
| 1950 | |
| 1951 | def test_random_partitions(): |
| 1952 | a, b = d.random_split([0.5, 0.5], 42) |
| 1953 | assert isinstance(a, dd.DataFrame) |
| 1954 | assert isinstance(b, dd.DataFrame) |
| 1955 | assert a._name != b._name |
| 1956 | np.testing.assert_array_equal(a.index, sorted(a.index)) |
| 1957 | |
| 1958 | assert len(a.compute()) + len(b.compute()) == len(full) |
| 1959 | a2, b2 = d.random_split([0.5, 0.5], 42) |
| 1960 | assert a2._name == a._name |
| 1961 | assert b2._name == b._name |
| 1962 | |
| 1963 | a, b = d.random_split([0.5, 0.5], 42, True) |
| 1964 | a2, b2 = d.random_split([0.5, 0.5], 42, True) |
| 1965 | assert_eq(a, a2) |
| 1966 | assert_eq(b, b2) |
| 1967 | with pytest.raises(AssertionError): |
| 1968 | np.testing.assert_array_equal(a.index, sorted(a.index)) |
| 1969 | |
| 1970 | parts = d.random_split([0.4, 0.5, 0.1], 42) |
| 1971 | names = {p._name for p in parts} |
| 1972 | names.update([a._name, b._name]) |
| 1973 | assert len(names) == 5 |
| 1974 | |
| 1975 | with pytest.raises(ValueError): |
| 1976 | d.random_split([0.4, 0.5], 42) |
| 1977 | |
| 1978 | |
| 1979 | def test_series_round(): |
nothing calls this directly
no test coverage detected