Hello, Anonymous:
Great question. I have been googling like mad ( = as if I were crazy) trying to find a rule. I have failed, so I shall NOT
answer your question.
I only wanted to point out that your quotation could be changed to:
After completing the exam, the doctor said, "You're pregnant."
With you, I shall now wait for someone to answer us.