Skip to content

Commit

Permalink
Merge pull request #194 from vocalpy/have-formats-as-list-alphabetize
Browse files Browse the repository at this point in the history
ENH: Make `formats.as_list` return sorted, fixes #187
  • Loading branch information
NickleDave committed Jun 17, 2022
2 parents 5b82395 + be9018c commit 5f36036
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/crowsetta/formats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def as_list():
List of strings, shorthand names that can be used
to access the class by calling
by their shorthand names"""
return list(FORMATS.keys())
return sorted(FORMATS.keys())


def register_format(format_class):
Expand Down
1 change: 1 addition & 0 deletions tests/test_formats/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
def test_as_list():
formats_list = crowsetta.formats.as_list()
assert isinstance(formats_list, list)
assert formats_list == sorted(crowsetta.formats.FORMATS.keys())
assert all(
[isinstance(format_name, str)
for format_name in formats_list]
Expand Down

0 comments on commit 5f36036

Please sign in to comment.