Accidentally changed in 1f92fd7577 and only noticed because there was a
suspicious drop in code coverage for the affected file.
Fix and add tests to ensure it doesn't happen again.
Pull Request: https://projects.blender.org/blender/blender/pulls/144702