def assertFSArraysEqual(self, a, b): # type: (FSArray, FSArray) -> None self.assertIsInstance(a, FSArray) self.assertIsInstance(b, FSArray) self.assertEqual( (a.width, b.height), (a.width, b.height), f"fsarray dimensions do not match: {a.shape} {b.shape}", ) for i, (a_row, b_row) in enumerate(zip(a, b)): self.assertEqual( a_row, b_row, "FSArrays differ first on line {}:\n{}".format( i, FSArray.diff(a, b)), )
def assertFSArraysEqualIgnoringFormatting(self, a, b): # type: (FSArray, FSArray) -> None """Also accepts arrays of strings""" self.assertEqual( len(a), len(b), "fsarray heights do not match: %s %s \n%s \n%s" % (len(a), len(b), simple_format(a), simple_format(b)), ) for i, (a_row, b_row) in enumerate(zip(a, b)): a_row = a_row.s if isinstance(a_row, FmtStr) else a_row b_row = b_row.s if isinstance(b_row, FmtStr) else b_row self.assertEqual( a_row, b_row, "FSArrays differ first on line %s:\n%s" % (i, FSArray.diff(a, b, ignore_formatting=True)), )