def test_changing_y_to_none_removes_associated_yerr_columns(self): """ Test to check if a first column is marked as Y, a second column YErr is associated with it, but then the first one is changed to X - the YErr mark should be removed """ mc = MarkedColumns() mc.add_y(4) ec = ErrorColumn(column=2, related_y_column=4, label_index=0) mc.add_y_err(ec) # check that we have both a Y col and an associated YErr self.assertEqual(1, len(mc.as_y)) self.assertEqual(1, len(mc.as_y_err)) mc.remove(4) # changing the column to NONE should have removed it from X, Y and YErr self.assertEqual(0, len(mc.as_x)) self.assertEqual(0, len(mc.as_y)) self.assertEqual(0, len(mc.as_y_err))
def test_changing_y_to_none_removes_associated_yerr_columns(self): """ Test to check if a first column is marked as Y, a second column YErr is associated with it, but then the first one is changed to X - the YErr mark should be removed """ mc = MarkedColumns() mc.add_y(4) ec = ErrorColumn(column=2, related_y_column=4, label_index=0) mc.add_y_err(ec) # check that we have both a Y col and an associated YErr self.assertEqual(1, len(mc.as_y)) self.assertEqual(1, len(mc.as_y_err)) mc.remove(4) # changing the column to NONE should have removed it from X, Y and YErr self.assertEqual(0, len(mc.as_x)) self.assertEqual(0, len(mc.as_y)) self.assertEqual(0, len(mc.as_y_err))
def test_remove_column(self): mc = MarkedColumns() mc.add_y(4) mc.add_x(3) ec = ErrorColumn(column=2, related_y_column=6) mc.add_y_err(ec) self.assertEqual(1, len(mc.as_x)) self.assertEqual(1, len(mc.as_y)) self.assertEqual(1, len(mc.as_y_err)) mc.remove(4) self.assertEqual(0, len(mc.as_y)) self.assertEqual(1, len(mc.as_y_err)) self.assertEqual(1, len(mc.as_x)) mc.remove(3) self.assertEqual(0, len(mc.as_x)) self.assertEqual(0, len(mc.as_y)) self.assertEqual(1, len(mc.as_y_err)) mc.remove(2) self.assertEqual(0, len(mc.as_x)) self.assertEqual(0, len(mc.as_y)) self.assertEqual(0, len(mc.as_y_err))
def test_remove_column(self): mc = MarkedColumns() mc.add_y(4) mc.add_x(3) ec = ErrorColumn(column=2, related_y_column=6, label_index=0) mc.add_y_err(ec) self.assertEqual(1, len(mc.as_x)) self.assertEqual(1, len(mc.as_y)) self.assertEqual(1, len(mc.as_y_err)) mc.remove(4) self.assertEqual(0, len(mc.as_y)) self.assertEqual(1, len(mc.as_y_err)) self.assertEqual(1, len(mc.as_x)) mc.remove(3) self.assertEqual(0, len(mc.as_x)) self.assertEqual(0, len(mc.as_y)) self.assertEqual(1, len(mc.as_y_err)) mc.remove(2) self.assertEqual(0, len(mc.as_x)) self.assertEqual(0, len(mc.as_y)) self.assertEqual(0, len(mc.as_y_err))