Fix an issue with module-level functions having named parameters

Module-level functions having at least one named parameter were not correctly verifying expectations. A test is provided that verifies the fix.

I'm not at all confident that this is the correct or best way to solve this, but it does solve it with no apparent regressions.