diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0dbe275..d434203 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -29,7 +29,7 @@ First, start always by reading the [Contribution Guide](https://pydataverse.read * [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/gdcc/pyDataverse/pulls) for the same update/change? * [ ] Have you followed the guidelines in our [Contribution Guide](https://pydataverse.readthedocs.io/en/master/contributing/contributing.html)? * [ ] Have you read the [Code of Conduct](https://github.com/gdcc/pyDataverse/blob/master/CODE_OF_CONDUCT.md)? -* [ ] Do your changes in a seperate branch. Branches MUST have descriptive names. +* [ ] Do your changes in a separate branch. Branches MUST have descriptive names. * [ ] Have you merged the latest changes from upstream to your branch? **Describe the PR** @@ -45,7 +45,7 @@ First, start always by reading the [Contribution Guide](https://pydataverse.read * [ ] Have you used tox and/or pytest for testing the changes? * [ ] Did the local testing ran successfully? -* [ ] Did the Continous Integration testing (Travis-CI) ran successfully? +* [ ] Did the Continuous Integration testing (Travis-CI) ran successfully? **Commits** diff --git a/local-test.env b/local-test.env index 7400574..1eeeaa0 100644 --- a/local-test.env +++ b/local-test.env @@ -6,4 +6,4 @@ CONFIGBAKER_IMAGE=docker.io/gdcc/configbaker:unstable # Services POSTGRES_VERSION=15 -SOLR_VERSION=9.3.0 \ No newline at end of file +SOLR_VERSION=9.3.0 diff --git a/tests/api/test_async_api.py b/tests/api/test_async_api.py index 61b1910..12c4e3a 100644 --- a/tests/api/test_async_api.py +++ b/tests/api/test_async_api.py @@ -3,10 +3,8 @@ class TestAsyncAPI: - @pytest.mark.asyncio async def test_async_api(self, native_api): - async with native_api: tasks = [native_api.get_info_version() for _ in range(10)] responses = await asyncio.gather(*tasks) diff --git a/tests/data/dataset_upload_full_default.json b/tests/data/dataset_upload_full_default.json index 848dd1b..6ab8614 100644 --- a/tests/data/dataset_upload_full_default.json +++ b/tests/data/dataset_upload_full_default.json @@ -437,13 +437,18 @@ "typeName": "kindOfData", "multiple": true, "typeClass": "primitive", - "value": ["KindOfData1", "KindOfData2"] + "value": [ + "KindOfData1", + "KindOfData2" + ] }, { "typeName": "language", "multiple": true, "typeClass": "controlledVocabulary", - "value": ["German"] + "value": [ + "German" + ] }, { "typeName": "series", @@ -489,25 +494,37 @@ "typeName": "relatedMaterial", "multiple": true, "typeClass": "primitive", - "value": ["RelatedMaterial1", "RelatedMaterial2"] + "value": [ + "RelatedMaterial1", + "RelatedMaterial2" + ] }, { "typeName": "relatedDatasets", "multiple": true, "typeClass": "primitive", - "value": ["RelatedDatasets1", "RelatedDatasets2"] + "value": [ + "RelatedDatasets1", + "RelatedDatasets2" + ] }, { "typeName": "otherReferences", "multiple": true, "typeClass": "primitive", - "value": ["OtherReferences1", "OtherReferences2"] + "value": [ + "OtherReferences1", + "OtherReferences2" + ] }, { "typeName": "dataSources", "multiple": true, "typeClass": "primitive", - "value": ["DataSources1", "DataSources2"] + "value": [ + "DataSources1", + "DataSources2" + ] }, { "typeName": "originOfSources", @@ -569,7 +586,10 @@ "typeName": "geographicUnit", "multiple": true, "typeClass": "primitive", - "value": ["GeographicUnit1", "GeographicUnit2"] + "value": [ + "GeographicUnit1", + "GeographicUnit2" + ] }, { "typeName": "geographicBoundingBox", @@ -613,13 +633,19 @@ "typeName": "unitOfAnalysis", "multiple": true, "typeClass": "primitive", - "value": ["UnitOfAnalysis1", "UnitOfAnalysis2"] + "value": [ + "UnitOfAnalysis1", + "UnitOfAnalysis2" + ] }, { "typeName": "universe", "multiple": true, "typeClass": "primitive", - "value": ["Universe1", "Universe2"] + "value": [ + "Universe1", + "Universe2" + ] }, { "typeName": "timeMethod", @@ -776,25 +802,39 @@ "typeName": "astroType", "multiple": true, "typeClass": "controlledVocabulary", - "value": ["Image", "Mosaic", "EventList", "Cube"] + "value": [ + "Image", + "Mosaic", + "EventList", + "Cube" + ] }, { "typeName": "astroFacility", "multiple": true, "typeClass": "primitive", - "value": ["Facility1", "Facility2"] + "value": [ + "Facility1", + "Facility2" + ] }, { "typeName": "astroInstrument", "multiple": true, "typeClass": "primitive", - "value": ["Instrument1", "Instrument2"] + "value": [ + "Instrument1", + "Instrument2" + ] }, { "typeName": "astroObject", "multiple": true, "typeClass": "primitive", - "value": ["Object1", "Object2"] + "value": [ + "Object1", + "Object2" + ] }, { "typeName": "resolution.Spatial", @@ -818,13 +858,19 @@ "typeName": "coverage.Spectral.Bandpass", "multiple": true, "typeClass": "primitive", - "value": ["Bandpass1", "Bandpass2"] + "value": [ + "Bandpass1", + "Bandpass2" + ] }, { "typeName": "coverage.Spectral.CentralWavelength", "multiple": true, "typeClass": "primitive", - "value": ["3001", "3002"] + "value": [ + "3001", + "3002" + ] }, { "typeName": "coverage.Spectral.Wavelength", @@ -900,7 +946,10 @@ "typeName": "coverage.Spatial", "multiple": true, "typeClass": "primitive", - "value": ["SkyCoverage1", "SkyCoverage2"] + "value": [ + "SkyCoverage1", + "SkyCoverage2" + ] }, { "typeName": "coverage.Depth", @@ -1007,7 +1056,10 @@ "typeName": "studyAssayOtherOrganism", "multiple": true, "typeClass": "primitive", - "value": ["OtherOrganism1", "OtherOrganism2"] + "value": [ + "OtherOrganism1", + "OtherOrganism2" + ] }, { "typeName": "studyAssayMeasurementType", @@ -1024,7 +1076,10 @@ "typeName": "studyAssayOtherMeasurmentType", "multiple": true, "typeClass": "primitive", - "value": ["OtherMeasurementType1", "OtherMeasurementType2"] + "value": [ + "OtherMeasurementType1", + "OtherMeasurementType2" + ] }, { "typeName": "studyAssayTechnologyType", @@ -1052,7 +1107,10 @@ "typeName": "studyAssayCellType", "multiple": true, "typeClass": "primitive", - "value": ["CellType1", "CellType2"] + "value": [ + "CellType1", + "CellType2" + ] } ] }, diff --git a/tests/data/file_upload_ds_minimum.json b/tests/data/file_upload_ds_minimum.json index 7746005..4611b81 100644 --- a/tests/data/file_upload_ds_minimum.json +++ b/tests/data/file_upload_ds_minimum.json @@ -1,75 +1,75 @@ { - "datasetVersion": { - "metadataBlocks": { - "citation": { - "fields": [ - { - "multiple": true, - "typeClass": "compound", - "typeName": "author", - "value": [ - { - "authorName": { - "multiple": false, - "typeClass": "primitive", - "typeName": "authorName", - "value": "John Doe" - } - } - ] - }, - { - "multiple": true, - "typeClass": "compound", - "typeName": "datasetContact", - "value": [ - { - "datasetContactName": { - "multiple": false, - "typeClass": "primitive", - "typeName": "datasetContactName", - "value": "John Doe" - }, - "datasetContactEmail": { - "multiple": false, - "typeClass": "primitive", - "typeName": "datasetContactEmail", - "value": "john@doe.com" - } - } - ] - }, - { - "multiple": true, - "typeClass": "compound", - "typeName": "dsDescription", - "value": [ - { - "dsDescriptionValue": { - "multiple": false, - "typeClass": "primitive", - "typeName": "dsDescriptionValue", - "value": "This is a description of the dataset" - } - } - ] - }, - { - "multiple": true, - "typeClass": "controlledVocabulary", - "typeName": "subject", - "value": [ - "Other" - ] - }, - { - "multiple": false, - "typeClass": "primitive", - "typeName": "title", - "value": "My dataset" - } - ] - } - } + "datasetVersion": { + "metadataBlocks": { + "citation": { + "fields": [ + { + "multiple": true, + "typeClass": "compound", + "typeName": "author", + "value": [ + { + "authorName": { + "multiple": false, + "typeClass": "primitive", + "typeName": "authorName", + "value": "John Doe" + } + } + ] + }, + { + "multiple": true, + "typeClass": "compound", + "typeName": "datasetContact", + "value": [ + { + "datasetContactName": { + "multiple": false, + "typeClass": "primitive", + "typeName": "datasetContactName", + "value": "John Doe" + }, + "datasetContactEmail": { + "multiple": false, + "typeClass": "primitive", + "typeName": "datasetContactEmail", + "value": "john@doe.com" + } + } + ] + }, + { + "multiple": true, + "typeClass": "compound", + "typeName": "dsDescription", + "value": [ + { + "dsDescriptionValue": { + "multiple": false, + "typeClass": "primitive", + "typeName": "dsDescriptionValue", + "value": "This is a description of the dataset" + } + } + ] + }, + { + "multiple": true, + "typeClass": "controlledVocabulary", + "typeName": "subject", + "value": [ + "Other" + ] + }, + { + "multiple": false, + "typeClass": "primitive", + "typeName": "title", + "value": "My dataset" + } + ] + } } + } } diff --git a/tests/data/replace.xyz b/tests/data/replace.xyz index 6065e4c..4436af4 100644 --- a/tests/data/replace.xyz +++ b/tests/data/replace.xyz @@ -1,3 +1,3 @@ A B C 3.4292 -4.32647 -1.66819 -3.4292 -4.51647 -1.65310 \ No newline at end of file +3.4292 -4.51647 -1.65310 diff --git a/tests/models/test_datafile.py b/tests/models/test_datafile.py index 55793da..7fec1c5 100644 --- a/tests/models/test_datafile.py +++ b/tests/models/test_datafile.py @@ -1,4 +1,5 @@ """Datafile data model tests.""" + import json import jsonschema import os @@ -244,7 +245,10 @@ def test_datafile_from_json_valid(self): ), (({json_upload_min()}, {"validate": False}), object_data_min()), ( - ({json_upload_min()}, {"filename_schema": "wrong", "validate": False},), + ( + {json_upload_min()}, + {"filename_schema": "wrong", "validate": False}, + ), object_data_min(), ), ( @@ -345,7 +349,10 @@ def test_datafile_to_json_valid(self): json.loads(json_upload_min()), ), ( - (dict_flat_set_min(), {"filename_schema": "wrong", "validate": False},), + ( + dict_flat_set_min(), + {"filename_schema": "wrong", "validate": False}, + ), json.loads(json_upload_min()), ), ( @@ -517,7 +524,10 @@ def test_dataverse_from_json_to_json_valid(self): ({json_upload_full()}, {}), ({json_upload_min()}, {"data_format": "dataverse_upload"}), ({json_upload_min()}, {"validate": False}), - ({json_upload_min()}, {"filename_schema": "wrong", "validate": False},), + ( + {json_upload_min()}, + {"filename_schema": "wrong", "validate": False}, + ), ( {json_upload_min()}, { @@ -550,4 +560,6 @@ def test_dataverse_from_json_to_json_valid(self): for key, val in pdv_end.get().items(): assert getattr(pdv_start, key) == getattr(pdv_end, key) - assert len(pdv_start.__dict__) == len(pdv_end.__dict__,) + assert len(pdv_start.__dict__) == len( + pdv_end.__dict__, + ) diff --git a/tests/models/test_dataset.py b/tests/models/test_dataset.py index fb01d0f..601bb15 100644 --- a/tests/models/test_dataset.py +++ b/tests/models/test_dataset.py @@ -1,4 +1,5 @@ """Dataset data model tests.""" + import json import os import platform @@ -950,11 +951,17 @@ def test_dataset_from_json_valid(self): ), (({json_upload_min()}, {"validate": False}), object_data_min()), ( - ({json_upload_min()}, {"filename_schema": "", "validate": False},), + ( + {json_upload_min()}, + {"filename_schema": "", "validate": False}, + ), object_data_min(), ), ( - ({json_upload_min()}, {"filename_schema": "wrong", "validate": False},), + ( + {json_upload_min()}, + {"filename_schema": "wrong", "validate": False}, + ), object_data_min(), ), ( @@ -995,11 +1002,17 @@ def test_dataset_to_json_valid(self): json.loads(json_upload_min()), ), ( - (dict_flat_set_min(), {"filename_schema": "", "validate": False},), + ( + dict_flat_set_min(), + {"filename_schema": "", "validate": False}, + ), json.loads(json_upload_min()), ), ( - (dict_flat_set_min(), {"filename_schema": "wrong", "validate": False},), + ( + dict_flat_set_min(), + {"filename_schema": "wrong", "validate": False}, + ), json.loads(json_upload_min()), ), ( @@ -1167,7 +1180,10 @@ def test_dataset_to_json_from_json_valid(self): (dict_flat_set_full(), {}), (dict_flat_set_min(), {"data_format": "dataverse_upload"}), (dict_flat_set_min(), {"validate": False}), - (dict_flat_set_min(), {"filename_schema": "wrong", "validate": False},), + ( + dict_flat_set_min(), + {"filename_schema": "wrong", "validate": False}, + ), ( dict_flat_set_min(), { @@ -1180,7 +1196,6 @@ def test_dataset_to_json_from_json_valid(self): ] for data_set, kwargs_from in data: - kwargs = {} pdv_start = data_object() pdv_start.set(data_set) @@ -1200,4 +1215,6 @@ def test_dataset_to_json_from_json_valid(self): for key, val in pdv_end.get().items(): assert getattr(pdv_start, key) == getattr(pdv_end, key) - assert len(pdv_start.__dict__) == len(pdv_end.__dict__,) + assert len(pdv_start.__dict__) == len( + pdv_end.__dict__, + ) diff --git a/tests/models/test_dataverse.py b/tests/models/test_dataverse.py index a4c362e..946fdc6 100644 --- a/tests/models/test_dataverse.py +++ b/tests/models/test_dataverse.py @@ -1,4 +1,5 @@ """Dataverse data model tests.""" + import json import jsonschema import os @@ -296,11 +297,17 @@ def test_dataverse_from_json_valid(self): ), (({json_upload_min()}, {"validate": False}), object_data_min()), ( - ({json_upload_min()}, {"filename_schema": "", "validate": False},), + ( + {json_upload_min()}, + {"filename_schema": "", "validate": False}, + ), object_data_min(), ), ( - ({json_upload_min()}, {"filename_schema": "wrong", "validate": False},), + ( + {json_upload_min()}, + {"filename_schema": "wrong", "validate": False}, + ), object_data_min(), ), ( @@ -401,11 +408,17 @@ def test_dataverse_to_json_valid(self): json.loads(json_upload_min()), ), ( - (dict_flat_set_min(), {"filename_schema": "", "validate": False},), + ( + dict_flat_set_min(), + {"filename_schema": "", "validate": False}, + ), json.loads(json_upload_min()), ), ( - (dict_flat_set_min(), {"filename_schema": "wrong", "validate": False},), + ( + dict_flat_set_min(), + {"filename_schema": "wrong", "validate": False}, + ), json.loads(json_upload_min()), ), ( @@ -583,8 +596,14 @@ def test_dataverse_from_json_to_json_valid(self): ({json_upload_full()}, {}), ({json_upload_min()}, {"data_format": "dataverse_upload"}), ({json_upload_min()}, {"validate": False}), - ({json_upload_min()}, {"filename_schema": "", "validate": False},), - ({json_upload_min()}, {"filename_schema": "wrong", "validate": False},), + ( + {json_upload_min()}, + {"filename_schema": "", "validate": False}, + ), + ( + {json_upload_min()}, + {"filename_schema": "wrong", "validate": False}, + ), ( {json_upload_min()}, { @@ -614,4 +633,6 @@ def test_dataverse_from_json_to_json_valid(self): for key, val in pdv_end.get().items(): assert getattr(pdv_start, key) == getattr(pdv_end, key) - assert len(pdv_start.__dict__) == len(pdv_end.__dict__,) + assert len(pdv_start.__dict__) == len( + pdv_end.__dict__, + ) diff --git a/tests/models/test_dvobject.py b/tests/models/test_dvobject.py index 26e96d3..9164011 100644 --- a/tests/models/test_dvobject.py +++ b/tests/models/test_dvobject.py @@ -1,4 +1,5 @@ """Dataverse data model tests.""" + from pyDataverse.models import DVObject