You need to change this to `raise ValueError("This pattern contains no groups to capture.")` otherwise it will fail in Python 3 (as it does currently on Travis).