Fix logic inversion bug (remove context manager)

Fix logic inversion bug by removing context manager asserting exception.