Use assertRaises instead of try/except/else

Change-Id: I8b1105404511c003e032f03777ce85325abbe0cd
Merge "Use assertRaises instead of try/except/else"