def _check_arcs(self, a1, a2, arc_type): """Check that the arc lists `a1` and `a2` are equal. If they are equal, return empty string. If they are unequal, return a string explaining what is different. """ # Make them into multi-line strings so we can see what's going wrong. s1 = arcs_to_arcz_repr(a1) s2 = arcs_to_arcz_repr(a2) if s1 != s2: lines1 = s1.splitlines(True) lines2 = s2.splitlines(True) diff = "".join(difflib.ndiff(lines1, lines2)) return "\n" + arc_type + " arcs differ: minus is expected, plus is actual\n" + diff else: return ""
def test_arcs_to_arcz_repr(arcs, arcz_repr): assert arcs_to_arcz_repr(arcs) == arcz_repr
def assert_equal_arcs(self, a1, a2, msg=None): """Assert that the arc lists `a1` and `a2` are equal.""" # Make them into multi-line strings so we can see what's going wrong. s1 = arcs_to_arcz_repr(a1) s2 = arcs_to_arcz_repr(a2) self.assertMultiLineEqual(s1, s2, msg)