I've just edited my previous post to make the situation a little clearer.
Before I opened the motor casing, I tested the latch function by turning the screwdriver slot with a screwdriver. I was able to turn the screwdriver in the slot but the latch did not respond.
After reassembling the casing, I performed the same test and the latch opened and closed perfectly.
However, having refitted it to the hood and having had it fail to latch to the screen when tested, I again removed it from the car and tried it with the screwdriver. The screwdriver turned the slot normally but the latch would not respond in any way.
It seems that, when I put the motor back in the car, the drive gear fails for some reason.
Also, while I'm testing in the car, I have to press the button several times in order to unlatch the hood – as the good latch only works for two seconds at a time while unlatching. The button will lower the roof completely with one continuous press and raise it and latch it with one continuous press. However, when I'm unlatching, it takes three or four presses to get it done.