Pregnancy test

How soon after I have sex can I take a pregnancy test?