Allah says: "Those are the ones of whom Allah knows what is in their hearts" regarding polytheism and hypocrisy.
قَالَ الله: ﴿أُولَئِكَ الَّذِينَ يَعْلَمُ اللَّهُ مَا فِي قُلُوبِهِمْ﴾ مِنَ الشّرك والنفاق