Skip to content
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

Closed
wants to merge 3 commits into from
Closed

Schema bump #2395

wants to merge 3 commits into from

Conversation

Glignos
Copy link
Contributor

@Glignos Glignos commented May 31, 2017

Related Issue

Closes #2266

Checklist:

  • I have all the information that I need (if not, move to RFC and look for it).
  • I linked the related issue(s) in the corresponding commit logs.
  • I wrote good commit log messages.
  • My code follows the code style of this project.
  • I've added any new docs if API/utils methods were added.
  • I have updated the existing documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Glignos added 2 commits May 31, 2017 17:52
* 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]>
@david-caro
Copy link
Contributor

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')
Copy link
Contributor

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)

Copy link
Contributor Author

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)
Copy link
Contributor

@jacquerie jacquerie Jun 2, 2017

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():
Copy link
Contributor

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>'
Copy link
Contributor

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>'
Copy link
Contributor

@jacquerie jacquerie Jun 5, 2017

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
Copy link
Contributor

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...

@jacquerie
Copy link
Contributor

Since I will need #2267 to be done for #2227, and #2267 depends on #2266, I will take over this PR.

'Neutrinoless double beta decay': '3.4'
}

return experiments_list[value.get('a')]
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants