Replace try blocks with self.assertRaises