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():
    KeyboardInterrupt

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:

https://docs.python.org/3/tutorial/errors.html