def test_includes_diff_of_coerced_arguments(self): expected = "A tuple", "that differs", "here." observed = "A tuple", "that differs", "HERE." mismatch = TextEquals(expected).match(observed) details = mismatch.get_details() self.assertThat(details, ContainsDict({"diff": IsInstance(Content)})) self.assertThat(details["diff"].as_text(), Equals(dedent("""\ --- expected +++ observed - ('A tuple', 'that differs', 'here.') ? ^^^^ + ('A tuple', 'that differs', 'HERE.') ? ^^^^ """)))
def test_includes_diff_of_mismatch(self): expected = "A line of text that differs at the end." observed = "A line of text that differs at THE end." mismatch = TextEquals(expected).match(observed) details = mismatch.get_details() self.assertThat(details, ContainsDict({"diff": IsInstance(Content)})) self.assertThat(details["diff"].as_text(), Equals(dedent("""\ --- expected +++ observed - A line of text that differs at the end. ? ^^^ + A line of text that differs at THE end. ? ^^^ """)))
def test_includes_diff_of_mismatch_multiple_lines(self): expected = "A line of text that differs\nat the end of the 2nd line." observed = "A line of text that differs\nat the end of the 2ND line." mismatch = TextEquals(expected).match(observed) details = mismatch.get_details() self.assertThat(details, ContainsDict({"diff": IsInstance(Content)})) self.assertThat(details["diff"].as_text(), Equals(dedent("""\ --- expected +++ observed A line of text that differs - at the end of the 2nd line. ? ^^ + at the end of the 2ND line. ? ^^ """)))