A method for testing the function of a pressure switch of a tank ventilation system for an internal combustion engine of a motor vehicle, the pressure switch being in a low-pressure position if the pressure in the tank ventilation system is lower than a predefined pressure limit, and the pressure switch being in a high-pressure position if that is not the case, wherein the method comprises the following steps:
- detecting a switched state of the pressure switch,
- carrying out a measure that increases the pressure in the tank ventilation system above the pressure limit if the pressure switch is in the low-pressure position,
- identifying a defect of the pressure switch if the pressure switch remains in the low-pressure position after the measure has been carried out.