Abu Saeed Khudri reported,

Some men from among the hypocrites during the time of the Messenger of Allah ﷺ used to stay behind whenever the Prophet ﷺ set out for battle, rejoicing at remaining behind in opposition to the Messenger of Allah ﷺ. When the Prophet ﷺ returned, they would offer him excuses and swear oaths, wishing to be praised for what they had not done. So the verse was revealed, "Do not think that those who rejoice in what they have done and love to be praised for what they have not done, do not think them to be safe from punishment" [Aal Imran 3:188].

Muslim 7033

Sahih

حدثنا الحسن بن علي الحلواني ومحمد بن سهل التميمي قالا حدثنا ابن أبي مريم أخبرنا محمد بن جعفر أخبرني زيد بن أسلم عن عطاء بن يسار

عن أبي سعيد الخدري

أن رجالا من المنافقين في عهد رسول الله ﷺ كانوا إذا خرج النبي ﷺ إلى الغزو تخلفوا عنه وفرحوا بمقعدهم خلاف رسول الله ﷺ فإذا قدم النبي ﷺ اعتذروا إليه وحلفوا وأحبوا أن يحمدوا بما لم يفعلوا فنزلت {لا تحسبن الذين يفرحون بما أتوا ويحبون أن يحمدوا بما لم يفعلوا فلا تحسبنهم بمفازة من العذاب}

مسلم 7033صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Characteristics of the hypocrites and their rulings
Chapter
Characteristics of the hypocrites and their rulings
Numbering
Darussalam 7033
Muslim 7033