Skip to content

Commit 4a382fc

Browse files
committed
Fix 360 w/ titles roundtrip
1 parent 0f3a852 commit 4a382fc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

flattentool/json_input.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ def sheet_key_title(sheet, key, id_key=None):
5555
If the key has a corresponding title, return that. If doesn't, create it in the sheet and return it.
5656
5757
"""
58+
if id_key: # call sheet_key_field instead
59+
return sheet_key_field(sheet, key, id_key)
5860
title_lookup = {v: k for k, v in sheet.titles.items()}
5961
if key in title_lookup:
6062
return title_lookup[key]

flattentool/tests/fixtures/WellcomeTrust-grants_fixed_2_grants.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
],
2727
"Surname of applicant": "Addison",
2828
"Grant number": "105177/Z/14/Z",
29-
"amountAwarded": 152505,
3029
"recipientOrganization": [
3130
{
3231
"addressLocality": "London",
@@ -71,7 +70,6 @@
7170
],
7271
"Surname of applicant": "Sandell",
7372
"Grant number": "105182/Z/14/Z",
74-
"amountAwarded": 178990,
7573
"Grant type": "Large Arts Awards",
7674
"Full name of applicant": "Prof Richard Sandell",
7775
"awardDate": "24/07/2014"

flattentool/tests/test_roundtrip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_roundtrip(tmpdir, output_format):
3131
assert original_json == roundtripped_json
3232

3333

34-
@pytest.mark.parametrize('use_titles', [False, pytest.mark.xfail(True)])
34+
@pytest.mark.parametrize('use_titles', [False, True])
3535
@pytest.mark.parametrize('output_format', ['xlsx'])#, 'csv'])
3636
def test_roundtrip_360(tmpdir, output_format, use_titles):
3737
input_name = 'flattentool/tests/fixtures/WellcomeTrust-grants_fixed_2_grants.json'

0 commit comments

Comments
 (0)