In the office building of a client the bathrooms are single occupancy and each has a lock.  That's not surprising.  When you enter the bathroom and push in the button on the handle to lock the door, the door is locked.  Still sane.  However, whenever the door closes, it unlocks!  So, if you enter the bathroom and lock the door behind you, it will unlock itself when it finishes closing.

The only way to have a locked door is to wait until the door is fully closed before pushing in the button.  The only affordance that the door has unlocked is a barely-audible "click", and there is nothing special about this door or locking mechanism that will tell you it is going to unlock automatically -- it looks exactly like thousands of other doors with push-button locks.

The defense of this design is that you don't want people to be locked out of the bathroom, and this design prevents that from happening.  However, which is worse:  unlocking the bathroom while someone is inside and thinks it is locked, or risking the possibility that someone could lock themselves out of the bathroom?

If you chose "someone locking themselves out of the bathroom", then you should not be in charge of designing anything, ever.