def testInsertColumn(self): q1 = LinkedMatrix(2, 3, "t") x1, y1 = q1.dimensions q1.insertColumn(0) x2, y2 = q1.dimensions self.assertEquals(y1, y2, "inserting column: a new row appeared from nowhere!") self.assertNotEquals(x1, x2, "inserting column: dimensions didn't change") self.assertEquals(x1 + 1, x2, "inserting column: wrong new dimensions")
def testInsertColumn(self): q1 = LinkedMatrix(2, 3, "t") x1, y1 = q1.dimensions q1.insertColumn(0) x2, y2 = q1.dimensions self.assertEquals( y1, y2, "inserting column: a new row appeared from nowhere!") self.assertNotEquals(x1, x2, "inserting column: dimensions didn't change") self.assertEquals(x1 + 1, x2, "inserting column: wrong new dimensions")
def testInsertAndDeleteColumn1(self): q1 = LinkedMatrix(2, 3, "t") strBefore = str(q1) d = q1.dimensions q1.removeColumn(1) strDuring = str(q1) q1.insertColumn(1) strAfter = str(q1) self.assertEquals(d, q1.dimensions, "inserting & deleting columns: dimensions were not updated") self.assertNotEquals(strBefore, strDuring, "inserting & deleting columns: nothing changed during delete") message = '''inserting & deleting columns: values changed unexpectedly before we deleted, the test matrix contained: {} after we deleted, the test matrix contained: {} after we inserted, the test matrix contained: {}''' message = message.format(strBefore, strDuring, strAfter) self.assertEquals(strBefore, strAfter, message)
def testInsertAndDeleteColumn1(self): q1 = LinkedMatrix(2, 3, "t") strBefore = str(q1) d = q1.dimensions q1.removeColumn(1) strDuring = str(q1) q1.insertColumn(1) strAfter = str(q1) self.assertEquals( d, q1.dimensions, "inserting & deleting columns: dimensions were not updated") self.assertNotEquals( strBefore, strDuring, "inserting & deleting columns: nothing changed during delete") message = '''inserting & deleting columns: values changed unexpectedly before we deleted, the test matrix contained: {} after we deleted, the test matrix contained: {} after we inserted, the test matrix contained: {}''' message = message.format(strBefore, strDuring, strAfter) self.assertEquals(strBefore, strAfter, message)