New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update StrEnum to be case insensitive #285
Conversation
Thanks for submitting! Seems reasonable, I'd like to see some tests if you're up for it! |
Do you want me to write some new ones or run the already existing ones? |
Just a few new tests verifying that the new meta works 👌 |
Hi! I'm fixing another issue as well and it would be good to release these at the same time. Are you down to write the tests in the near future? If not, I could just push some on this branch and we'll get it in. |
Other tests should pretty much pass now if you rebase on master! |
Ok, I'll rebase when I get some time. Feel free to yourself if that's easier. |
Wrote some tests. Realized I had accidentally set the value to lowercase in the lookup and not the key, which would have done nothing. That's fixed now. |
Thanks for testing it too! Apparently I wasn't in such a hurry :P Sorry for taking so long. It'll be released today! |
Spotify recently changed their enums to be all caps in some cases. I found them specifically in
album_type
it'sALBUM
instead ofalbum
, which breaks tekore in some cases. tekore broke because it assumed that these keys were a specific case.The change I've implemented makes it so that when creating the tekore models, finding the AlbumType and other StrEnum objects is case insensitive. This will help future proof in case Spotify does something similar again in the future. My implementation does not modify values of the enums, just how they are stored and later indexed. If a different solution is desired, let me know.
tox
checks passed with an appropriately configuredenvironment