-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exploratory field method refactor #166
Draft
ehanson8
wants to merge
4
commits into
field-method-refactor
Choose a base branch
from
timx-273-structure-exploration
base: field-method-refactor
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
from transmogrifier.config import SOURCES, load_external_config | ||
from transmogrifier.sources.jsontransformer import JSONTransformer | ||
from transmogrifier.sources.xml.datacite import Datacite | ||
from transmogrifier.sources.xml.dspace_dim import DspaceDim | ||
from transmogrifier.sources.xmltransformer import XMLTransformer | ||
|
||
|
||
|
@@ -43,13 +44,24 @@ def runner(): | |
return CliRunner() | ||
|
||
|
||
# aardvark ########################## | ||
|
||
|
||
@pytest.fixture | ||
def aardvark_records(): | ||
return JSONTransformer.parse_source_file("tests/fixtures/aardvark_records.jsonl") | ||
|
||
|
||
@pytest.fixture | ||
def aardvark_record_all_fields(): | ||
return JSONTransformer.parse_source_file( | ||
"tests/fixtures/aardvark/aardvark_record_all_fields.jsonl" | ||
) | ||
|
||
|
||
# datacite ########################## | ||
|
||
|
||
@pytest.fixture | ||
def datacite_records(): | ||
return XMLTransformer.parse_source_file( | ||
|
@@ -65,9 +77,42 @@ def datacite_record_all_fields(): | |
return Datacite("cool-repo", source_records) | ||
|
||
|
||
# dspace_dim ########################## | ||
|
||
|
||
@pytest.fixture | ||
def aardvark_records(): | ||
return JSONTransformer.parse_source_file("tests/fixtures/aardvark_records.jsonl") | ||
def dspace_dim_record_all_fields(): | ||
source_records = DspaceDim.parse_source_file( | ||
"tests/fixtures/dspace/dspace_dim_record_all_fields.xml" | ||
) | ||
return next(source_records) | ||
|
||
|
||
@pytest.fixture | ||
def dspace_dim_record_attribute_and_subfield_variations(): | ||
source_records = DspaceDim.parse_source_file( | ||
"tests/fixtures/dspace/dspace_dim_record_attribute_and_subfield_variations.xml" | ||
) | ||
return next(source_records) | ||
|
||
|
||
@pytest.fixture | ||
def dspace_dim_record_optional_fields_blank(): | ||
source_records = DspaceDim.parse_source_file( | ||
"tests/fixtures/dspace/dspace_dim_record_optional_fields_blank.xml" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should likely rename this fixture and |
||
) | ||
return next(source_records) | ||
|
||
|
||
@pytest.fixture | ||
def dspace_dim_record_optional_fields_missing(): | ||
source_records = DspaceDim.parse_source_file( | ||
"tests/fixtures/dspace/dspace_dim_record_optional_fields_missing.xml" | ||
) | ||
return next(source_records) | ||
|
||
|
||
# marc ########################## | ||
|
||
|
||
@pytest.fixture | ||
|
@@ -80,11 +125,17 @@ def marc_content_type_crosswalk(): | |
return load_external_config("config/marc_content_type_crosswalk.json", "json") | ||
|
||
|
||
# oaidc ########################## | ||
|
||
|
||
@pytest.fixture | ||
def oai_pmh_records(): | ||
return XMLTransformer.parse_source_file("tests/fixtures/oai_pmh_records.xml") | ||
|
||
|
||
# timdex ########################## | ||
|
||
|
||
@pytest.fixture | ||
def timdex_record_required_fields(): | ||
return timdex.TimdexRecord( | ||
|
File renamed without changes.
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike the
_attribute_and_subfield_variations
fixtures (which I didn't touch but have concerns about how useful they are),_errors
fixtures are intended to hold all edge cases that would trigger logging or alternate behavior. Keeping them all in one fixture that is used by multiple edge case tests (test_get_dates_invalid_date_range_skipped
) should keep the testing suite cleaner. Open to other names for this fixture