Skip to content

Commit

Permalink
removed downcasing of keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
d-giles committed May 8, 2024
1 parent 4962856 commit 54000c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions pyvo/dal/sia.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,13 @@ def format(self, format_):
if not isinstance(format_, list):
format_ = format_.split(',')
normalized_formats = []
for _ in format_:
if _.upper() in ['ALL', 'METADATA', 'GRAPHIC', 'GRAPHIC-ALL']:
normalized_formats += [_.upper()]
elif _.split('-')[0].upper() == 'GRAPHIC':
normalized_formats += [_.split('-')[0].upper()+"-"+_.split('-')[1]]
elif _.lower() in ['image', 'image/png', 'image/jpeg', 'image/gif',
'image/fits', 'png', 'jpeg', 'fits', 'gif']:
normalized_formats += [_.lower()]
for user_input in format_:
if user_input.upper() in ['ALL', 'METADATA', 'GRAPHIC', 'GRAPHIC-ALL']:
normalized_formats += [user_input.upper()]
elif user_input.split('-')[0].upper() == 'GRAPHIC':
normalized_formats += [user_input.split('-')[0].upper()+"-"+user_input.split('-')[1]]
else:
normalized_formats += [_]
normalized_formats += [user_input]

self["FORMAT"] = ",".join(normalized_formats)

Expand Down
2 changes: 1 addition & 1 deletion pyvo/dal/tests/test_sia.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_search(self):
@pytest.mark.filterwarnings("ignore::astropy.io.votable.exceptions.W49")
def test_formatter(self):
service = SIAQuery('http://example.com/sia')
service.format = "Image"
service.format = "image"
assert service["FORMAT"] == "image"
service.format = "all"
assert service["FORMAT"] == "ALL"
Expand Down

0 comments on commit 54000c6

Please sign in to comment.