798 convert pivoted to standard shape when loading dataframe #1211
3 fail, 503 pass in 1m 12s
Annotations
Check warning on line 0 in tests.unit.inspect.sparqlhandler.test_data_cube_repository
github-actions / ubuntu-latest-python3.9- test results
test_shape_conversion_on_pivoted_multi_measure_dataset (tests.unit.inspect.sparqlhandler.test_data_cube_repository) failed
pytest_results.xml [took 0s]
Raw output
OSError: Cannot save file into a non-existent directory: 'out'
def test_shape_conversion_on_pivoted_multi_measure_dataset():
"""
Testing that a dataframe with columns represented in the correct data types
can be loaded from a standard shape CSVW and that a distinction is made between
attribute resource and attribute literal columns.
MULTI MEASURE
"""
csvw_metadata_json_path = (
_test_case_base_dir
/ "pivoted-multi-measure-dataset"
/ "qb-id-10003.csv-metadata.json"
)
data_cube_repository = get_data_cube_repository(csvw_metadata_json_path)
csv_url = data_cube_repository.get_primary_csv_url()
> dataframe, validation_errors = data_cube_repository.get_dataframe(
csv_url, shape_conversion=True
)
tests/unit/inspect/sparqlhandler/test_data_cube_repository.py:1387:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/csvcubed/inspect/sparql_handler/data_cube_repository.py:403: in get_dataframe
df.to_csv(Path(reshaped_df_file_name), index=False)
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/core/generic.py:3902: in to_csv
return DataFrameRenderer(formatter).to_csv(
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/formats/format.py:1152: in to_csv
csv_formatter.save()
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/formats/csvs.py:247: in save
with get_handle(
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/common.py:739: in get_handle
check_parent_directory(str(handle))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = 'out/unpivoted-qb-id-10003.csv'
def check_parent_directory(path: Path | str) -> None:
"""
Check if parent directory of a file exists, raise OSError if it does not
Parameters
----------
path: Path or str
Path to check parent directory of
"""
parent = Path(path).parent
if not parent.is_dir():
> raise OSError(rf"Cannot save file into a non-existent directory: '{parent}'")
E OSError: Cannot save file into a non-existent directory: 'out'
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/common.py:604: OSError
Check warning on line 0 in tests.unit.inspect.sparqlhandler.test_data_cube_repository
github-actions / ubuntu-latest-python3.9- test results
test_shape_conversion_on_pivoted_single_measure_dataset (tests.unit.inspect.sparqlhandler.test_data_cube_repository) failed
pytest_results.xml [took 0s]
Raw output
OSError: Cannot save file into a non-existent directory: 'out'
def test_shape_conversion_on_pivoted_single_measure_dataset():
"""
No uuids amd user friendly column names apear instead
SINGLE MEASURE
"""
csvw_metadata_json_path = (
_test_case_base_dir
/ "pivoted-single-measure-dataset"
/ "qb-id-10004.csv-metadata.json"
)
data_cube_repository = get_data_cube_repository(csvw_metadata_json_path)
csv_url = data_cube_repository.get_primary_csv_url()
> dataframe, validation_errors = data_cube_repository.get_dataframe(
csv_url, shape_conversion=True
)
tests/unit/inspect/sparqlhandler/test_data_cube_repository.py:1452:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/csvcubed/inspect/sparql_handler/data_cube_repository.py:403: in get_dataframe
df.to_csv(Path(reshaped_df_file_name), index=False)
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/core/generic.py:3902: in to_csv
return DataFrameRenderer(formatter).to_csv(
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/formats/format.py:1152: in to_csv
csv_formatter.save()
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/formats/csvs.py:247: in save
with get_handle(
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/common.py:739: in get_handle
check_parent_directory(str(handle))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = 'out/unpivoted-qb-id-10004.csv'
def check_parent_directory(path: Path | str) -> None:
"""
Check if parent directory of a file exists, raise OSError if it does not
Parameters
----------
path: Path or str
Path to check parent directory of
"""
parent = Path(path).parent
if not parent.is_dir():
> raise OSError(rf"Cannot save file into a non-existent directory: '{parent}'")
E OSError: Cannot save file into a non-existent directory: 'out'
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/common.py:604: OSError
Check warning on line 0 in tests.unit.inspect.sparqlhandler.test_data_cube_repository
github-actions / ubuntu-latest-python3.9- test results
test_shape_conversion_on_pivoted_multi_measure_single_unit_component (tests.unit.inspect.sparqlhandler.test_data_cube_repository) failed
pytest_results.xml [took 0s]
Raw output
OSError: Cannot save file into a non-existent directory: 'out'
def test_shape_conversion_on_pivoted_multi_measure_single_unit_component():
"""
No uuids amd user friendly column names apear instead
SINGLE MEASURE
"""
csvw_metadata_json_path = (
_test_case_base_dir
/ "pivoted-multi-measure-single-unit-component"
/ "multi-measure-pivoted-dataset-units-and-attributes.csv-metadata.json"
)
data_cube_repository = get_data_cube_repository(csvw_metadata_json_path)
csv_url = data_cube_repository.get_primary_csv_url()
> dataframe, validation_errors = data_cube_repository.get_dataframe(
csv_url, shape_conversion=True
)
tests/unit/inspect/sparqlhandler/test_data_cube_repository.py:1517:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/csvcubed/inspect/sparql_handler/data_cube_repository.py:403: in get_dataframe
df.to_csv(Path(reshaped_df_file_name), index=False)
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/core/generic.py:3902: in to_csv
return DataFrameRenderer(formatter).to_csv(
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/formats/format.py:1152: in to_csv
csv_formatter.save()
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/formats/csvs.py:247: in save
with get_handle(
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/common.py:739: in get_handle
check_parent_directory(str(handle))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = 'out/unpivoted-multi-measure-pivoted-dataset-units-and-attributes.csv'
def check_parent_directory(path: Path | str) -> None:
"""
Check if parent directory of a file exists, raise OSError if it does not
Parameters
----------
path: Path or str
Path to check parent directory of
"""
parent = Path(path).parent
if not parent.is_dir():
> raise OSError(rf"Cannot save file into a non-existent directory: '{parent}'")
E OSError: Cannot save file into a non-existent directory: 'out'
../../../.cache/pypoetry/virtualenvs/csvcubed-4ogRUYE2-py3.9/lib/python3.9/site-packages/pandas/io/common.py:604: OSError