This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creating ActivitySchema and OrganisationSchema classes (both children of iati.core.schema.Schema) means that we can better take account of differences between the activity and organisation schemas. This commit also modifies some implementation and test code. However, not all test code is modified, particularily where there is ambiguity about if an activity or organisation schema is being used.
This change removes the hard-coding of the resources/standard/.../schema folder in the implemention of the iati.core.schemas.Schema class. Through this, the code will be easier to test, as it will be easier to create mock schema files to be used to create Schema objects.
This fixes python2 tests, due to differences in the way that python2 and python3 deal with value hashing.
We have decided against the ability to create an iati.core.schema.Schema by an XML string, due to fact that XSD includes must be flattened within the schema. Inputted XML may contain relative file paths, which cannot be easily resolved.
This amends code to instantiate an iati.core.ActivitySchema or iati.core.OrganisationSchema (as appropriate to the type of schema. Some refactoring needed to remove duplicate code.
Renaming functions for consistency with other functions.
Relevant linting error not fixed is the apparent false-positive of: Invalid function name "get_all_organisation_schema_paths" (invalid-name)
The updated name ensures tests are run on both the default organisation and activity schemas.
Modify docstring indentation to be consistent with elsewhere.
iati.core.schema.Schema is designed to act as a base class for ActivitySchema and OrganisationSchema.
Adds functions for returning default activity_schemas and organisation_schemas, plus adds a source_path attribute to the Schema base class.
Add load_as_dataset to resources
Make tests/utilities.py easier to read
This is a tider method of using the strings. It is also more scalable since there are not valid strings that are prefixes of others - by searching for the surrounding strings.
Add a load_as_dataset function to test utils
The SSOT contains a number of datasets that are invalid against the schema. These raise a number of specific types of error. The errors that they raise have been added as specific types.
This can occur when checking an org file against an activity schema or vice versa.
The error appears to relate to the addition of an attribute in a custom namespace.
This is useful for datasets that have been saved on Windows, so have a UTF-16, ASCII or windows-1252 encoding.
hayfield
added
complete
A PR that is in a state that is ready for review.
and removed
incomplete
A PR that is in a state that is not ready for review.
labels
Aug 18, 2017
All of the errors present in live data when compared against the 2.02 Activity Schema are now detected. |
Fixes #42 somewhere along the lines |
Merging since will be reviewed later and is based on something else that was OK |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
complete
A PR that is in a state that is ready for review.
validation
Changes to validation functionality.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Provide detailed output about whether a Dataset contains valid IATI XML.