Skip to content

Instantly share code, notes, and snippets.

@behnam
Last active November 16, 2018 00:35
Show Gist options
  • Save behnam/0d0906f4cf910221299ab684a5bf31ac to your computer and use it in GitHub Desktop.
Save behnam/0d0906f4cf910221299ab684a5bf31ac to your computer and use it in GitHub Desktop.
snapshottest.sorted_dict.SortedDict only accepts string dict keys
import enum
import collections
import snapshottest
class Fruit(enum.Enum):
APPLE = 1
ORANGE = 2
test_value = {
Fruit.APPLE: 100,
Fruit.ORANGE: 400,
}
# This works fine...
collections.OrderedDict(**test_value)
# But this throws:
# ```
# TypeError: __init__() keywords must be strings
# ```
snapshottest.sorted_dict.SortedDict(**test_value)
@behnam
Copy link
Author

behnam commented Nov 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment