Rewrite an assert statement using str.replace()