python-bibtexparser
python-bibtexparser copied to clipboard
add NormalizeFieldKeys middleware
Here's an attempt at #467, which see.
Fixes #467
(Thanks BTW ;))
(Thanks BTW ;))
(np BTW ;))
Also, noticed that black was complaining, so reformatted both fieldkeys.py and test_fieldkeys.py using it.
Thanks @Technologicat !! Since I had a few minutes to spare, I offered some simplifying suggestions by adding to commits. Please don't hesitate to criticize / complement / revert.
4b328ba: Ok, nice shortened comment. Thanks. 6ad724f: Ok. 9eed680: Ok.
71ee1de: Nice shortening of the test unit. Thanks!
Regarding this commit, some minor comments:
Contrary to the docstring, the function test_normalize_fieldkeys is actually testing with lowercase keys. I think the docstring should be fixed. This is important, because as the old maxim goes, "if code and comments disagree, both are probably wrong".
Personally, I'd also avoid the name "foo{i}". A semantically meaningful name, such as "entry{i}", would increase clarity by making the intent explicit. Similarly, in test_normalize_fieldkeys_force_last, the bare "foo" could be e.g. "dummyvalue" to make it clear at a glance what it stands for.
(Using meaningful names exclusively is a habit I picked up from Racket docs ~half a decade ago. The standard metasyntactic names were fine in the 1970s, but we know better now. :) )
Sounds good! Would you like to make the changes?
Sure, here they are. :)
Ugh, a merge conflict. Fixed. And some flake8 warnings fixed, too.
Should be fine by me now.
Thanks a million!
Thanks for the merge!