Skip to content

Commit f368996

Browse files
committed
Make 3.5 python compatability and more robust metadata testing
1 parent 78e79b9 commit f368996

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

caltechdata_api/decustomize_schema.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ def decustomize_schema(json_record):
9191
new = {}
9292
new['nameIdentifier'] =\
9393
cid.pop('contributorIdentifier')
94-
new['nameIdentifierScheme'] =\
95-
cid.pop('contributorIdentifierScheme')
94+
if 'contributorIdentifierScheme' in cid:
95+
new['nameIdentifierScheme'] =\
96+
cid.pop('contributorIdentifierScheme')
9697
newa.append(new)
9798
c['nameIdentifiers']=newa
9899
del c['contributorIdentifiers']

caltechdata_api/get_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def get_metadata(idv,production=True):
1313
r = requests.get(api_url+str(idv))
1414
r_data = r.json()
1515
if 'message' in r_data:
16-
raise AssertionError(f'id {idv} expected http status 200, got {r_data.status} {r_data.message}')
16+
raise AssertionError('id '+idv+' expected http status 200, got '+r_data.status+r_data.message)
1717
if not 'metadata' in r_data:
18-
raise AssertionError(f'expected as metadata property in response, got {r_data}')
18+
raise AssertionError('expected as metadata property in response, got '+r_data)
1919
metadata = r_data['metadata']
2020
metadata = decustomize_schema(metadata)
2121

0 commit comments

Comments
 (0)