How to write a test for keyboard interruption

I’m going through the study drills of ex48, and thought to write a test case for a keyboard interruption. However I’m not sure if i’m doing it right.

I’ve done this:

def test_keyinterrupt():

the test runs without problems, but don’t know if it’ means that my keyboardInterrupt exception work?

You need to raise it though. Read through this: