Package: python-osw-validation
TDEI python lib OSW validation packageThis package validates the OSW geojson file. Package requires a OSW zip file pathSystem requirementsSoftwareVersionPython3.10.xWhat this package does?It unzip the provided zip filesCheck for the required nodes and edges geojson files inside the unzipped folderValidate each file (nodes, edges and points) against schema, schema can be found hereReturn true or false according to validationyou can check the error if it returned false.Starting a new project with templateAddpython-osw-validationpackage as dependency in yourrequirements.txtorpip install python-osw-validationStart using the packages in your code.Initialize and Configurationfrompython_osw_validationimportOSWValidationvalidator=OSWValidation(zipfile_path='<Zip file path>')result=validator.validate()print(result.is_valid)print(result.errors)TestingThe project is configured withpythonto figure out the coverage of the unit tests. All the tests are intestsfolder.To execute the tests, please follow the commands:pip install -r requirements.txtpython -m unittest discover -v tests/unit_testsTo execute the code coverage, please follow the commands:coverage run --source=src/python_osw_validation -m unittest discover -v tests/unit_testscoverage html// Can be run after 1st commandcoverage report// Can be run after 1st commandAfter the commands are run, you can check the coverage report inhtmlcov/index.html. Open the file in any browser,
and it shows complete coverage detailsThe terminal will show the output of coverage like this>coveragerun--source=src/python_osw_validation-munittestdiscover-vtests/unit_tests
test_invalid_empty_directory(test_extracted_data_validator.TestExtractedDataValidator)...ok
test_invalid_missing_files_directory(test_extracted_data_validator.TestExtractedDataValidator)...ok
test_invalid_missing_required_files_directory(test_extracted_data_validator.TestExtractedDataValidator)...ok
test_valid_directory_structure(test_extracted_data_validator.TestExtractedDataValidator)...ok
test_edges_invalid_zipfile(test_osw_validation.TestOSWValidation)...ok
test_edges_invalid_zipfile_with_invalid_schema(test_osw_validation.TestOSWValidation)...ok
test_edges_invalid_zipfile_with_schema(test_osw_validation.TestOSWValidation)...ok
test_extra_field_zipfile(test_osw_validation.TestOSWValidation)...ok
test_id_missing_zipfile(test_osw_validation.TestOSWValidation)...ok
test_invalid_geometry_zipfile(test_osw_validation.TestOSWValidation)...ok
test_invalid_zipfile(test_osw_validation.TestOSWValidation)...ok
test_invalid_zipfile_with_invalid_schema(test_osw_validation.TestOSWValidation)...ok
test_invalid_zipfile_with_schema(test_osw_validation.TestOSWValidation)...ok
test_minimal_zipfile(test_osw_validation.TestOSWValidation)...ok
test_minimal_zipfile_with_invalid_schema(test_osw_validation.TestOSWValidation)...ok
test_minimal_zipfile_with_schema(test_osw_validation.TestOSWValidation)...ok
test_missing_files_inside_zipfile(test_osw_validation.TestOSWValidation)...ok
test_missing_files_inside_zipfile_with_invalid_schema(test_osw_validation.TestOSWValidation)...ok
test_missing_files_inside_zipfile_with_schema(test_osw_validation.TestOSWValidation)...ok
test_missing_identifier_zipfile(test_osw_validation.TestOSWValidation)...ok
test_no_entity_zipfile(test_osw_validation.TestOSWValidation)...ok
test_nodes_invalid_zipfile(test_osw_validation.TestOSWValidation)...ok
test_nodes_invalid_zipfile_with_invalid_schema(test_osw_validation.TestOSWValidation)...ok
test_nodes_invalid_zipfile_with_schema(test_osw_validation.TestOSWValidation)...ok
test_points_invalid_zipfile(test_osw_validation.TestOSWValidation)...ok
test_points_invalid_zipfile_with_invalid_schema(test_osw_validation.TestOSWValidation)...ok
test_points_invalid_zipfile_with_schema(test_osw_validation.TestOSWValidation)...ok
test_valid_zipfile(test_osw_validation.TestOSWValidation)...ok
test_valid_zipfile_with_invalid_schema(test_osw_validation.TestOSWValidation)...ok
test_valid_zipfile_with_schema(test_osw_validation.TestOSWValidation)...ok
test_wrong_datatypes_zipfile(test_osw_validation.TestOSWValidation)...ok
test_extract_invalid_zip(test_zipfile_handler.TestZipFileHandler)...ok
test_extract_valid_zip(test_zipfile_handler.TestZipFileHandler)...ok
test_remove_extracted_files(test_zipfile_handler.TestZipFileHandler)...ok

----------------------------------------------------------------------
Ran34testsin121.220s

OK