|
17 | 17 | import pandas as pd |
18 | 18 | import pytest |
19 | 19 | import requests |
| 20 | +import requests_mock |
20 | 21 | import scipy.sparse |
21 | 22 | from oslo_concurrency import lockutils |
22 | 23 |
|
@@ -1496,16 +1497,6 @@ def test_data_fork(self): |
1496 | 1497 | data_id=999999, |
1497 | 1498 | ) |
1498 | 1499 |
|
1499 | | - @pytest.mark.production() |
1500 | | - def test_get_dataset_parquet(self): |
1501 | | - # Parquet functionality is disabled on the test server |
1502 | | - # There is no parquet-copy of the test server yet. |
1503 | | - openml.config.server = self.production_server |
1504 | | - dataset = openml.datasets.get_dataset(61, download_data=True) |
1505 | | - assert dataset._parquet_url is not None |
1506 | | - assert dataset.parquet_file is not None |
1507 | | - assert os.path.isfile(dataset.parquet_file) |
1508 | | - assert dataset.data_file is None # is alias for arff path |
1509 | 1500 |
|
1510 | 1501 | @pytest.mark.production() |
1511 | 1502 | def test_list_datasets_with_high_size_parameter(self): |
@@ -1952,3 +1943,17 @@ def test_read_features_from_xml_with_whitespace() -> None: |
1952 | 1943 | ) |
1953 | 1944 | dict = _read_features(features_file) |
1954 | 1945 | assert dict[1].nominal_values == [" - 50000.", " 50000+."] |
| 1946 | + |
| 1947 | + |
| 1948 | +def test_get_dataset_parquet(requests_mock, test_files_directory): |
| 1949 | + # Parquet functionality is disabled on the test server |
| 1950 | + # There is no parquet-copy of the test server yet. |
| 1951 | + content_file = ( |
| 1952 | + test_files_directory / "mock_responses" / "datasets" / "data_description_61.xml" |
| 1953 | + ) |
| 1954 | + requests_mock.get("https://www.openml.org/api/v1/xml/data/61", text=content_file.read_text()) |
| 1955 | + dataset = openml.datasets.get_dataset(61, download_data=True) |
| 1956 | + assert dataset._parquet_url is not None |
| 1957 | + assert dataset.parquet_file is not None |
| 1958 | + assert os.path.isfile(dataset.parquet_file) |
| 1959 | + assert dataset.data_file is None # is alias for arff path |
0 commit comments