The Runcorn and Helsby by-election was the first major electoral test for the prime minister