-
Notifications
You must be signed in to change notification settings - Fork 69
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
Schema bump #2395
Schema bump #2395
Conversation
* Edit the rules of dojson for experiments,according to schema 32 closes inspirehep#2266 Signed-off-by: Glignos <[email protected]>
* Edit the experiment autocompletion in accordance with the latest schemas Signed-off-by: Glignos <[email protected]>
You did not actually change the setup.py right? (to pin the schemas to the new version) |
@@ -48,56 +48,56 @@ def date_started(self, key, value): | |||
self['date_started'] = val.get('s') | |||
if val.get('t'): | |||
self['date_completed'] = val.get('t') | |||
if val.get('c'): | |||
self['date_cancelled'] = value.get('c') |
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.
We were actually missing this xd (it's not a change introduced by the bump, but a previous missing field)
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.
Ah well ☕
Also I changed the setup.py locally but I didn't commit it it in the PR
'record': { | ||
'$ref': 'http://localhost:5000/api/institutions/905439', | ||
}, | ||
}, | ||
] | ||
result = institutions.do(create_record(snippet)) | ||
|
||
assert validate(result['related_institutes'], subschema) is None | ||
assert expected == result['related_institutes'] | ||
print(result) |
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.
The expected
and result
pattern is designed exactly to prevent this: if you have a failing test you can invoke pytest
with the --pdb
flag and have it stop there, so that you can easily inspect the state.
@@ -758,7 +758,7 @@ def test_related_institutes_from__510_a_w_0(): | |||
assert expected == result['related_institutes'] | |||
|
|||
|
|||
def test_related_institutes_from__double_510_a_w_0(): | |||
def test_related_institutes_from__double_510_w_0(): |
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.
Why are you changing the test names? The test names denote the snippet that you're using. If the snippet doesn't change (and there's usually no reason to change the snippet), the test name doesn't change either!
' <subfield code="t">2008</subfield>' | ||
' <subfield code="c">2016</subfield>' | ||
' </datafield>' | ||
'</record>' |
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.
This test is way too optimistic: you'll never find data this clean in INSPIRE legacy. Look at what's actually in the records!
|
||
snippet = ( | ||
'<record>' | ||
' <datafield tag="119" ind1=" " ind2=" ">' | ||
' <subfield code="a">CERN-ALPHA</subfield>' | ||
' <subfield code="u">CERN</subfield>' | ||
' <subfield code="z">902725</subfield>' | ||
' <subfield code="c">NA61</subfield>' | ||
' <subfield code="b">LHC</subfield>' |
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.
This snippet was correct before, so it shouldn't have been modified. Previous tests are there to guarantee that you're not breaking earlier behavior.
@@ -30,6 +30,7 @@ | |||
from dojson.errors import IgnoreKey | |||
|
|||
from inspirehep.utils.helpers import force_list | |||
from inspire_schemas.api import LiteratureBuilder |
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.
Somehow I doubt that you're going to use the LiteratureBuilder
while creating experiment records...
'Neutrinoless double beta decay': '3.4' | ||
} | ||
|
||
return experiments_list[value.get('a')] |
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.
FYI: this wasn't correct, see inspirehep/inspire#301 for what should have happened here.
Related Issue
Closes #2266
Checklist:
RFC
and look for it).