[2.7] bpo-32107 - Backport bitmask check fix (GH-4576) (#4590)

Remove a flakey test and rewrite another one for readability.
1 file changed