Update test.py

Adding KeyError