Even when David is hating Gods enemies, he asks God to search his heart for impurities, that he might be refined by God.

www.bible.com/100/psa.139.23-24.nasb