def setUp(self): logging.disable(logging.CRITICAL) self.longMessage = True pointA = PointElement(2, 2, 2) pointB = PointElement(6, 1, 4) pointC = PointElement(4, 6, 3) points = [pointA, pointB, pointC] self.p_col = PointCollection(*points)
def test_min(self): pointMin = PointElement(2, 1, 2) self.assertEqual(self.p_col.min, pointMin)
def test_avg(self): pointAvg = PointElement(4, 3, 3) self.assertEqual(self.p_col.average, pointAvg)
def test_attributes(self): self.assertEqual(self.p_col.points[0], PointElement(2, 2, 2))
def test_max(self): pointMax = PointElement(6, 6, 4) self.assertEqual(self.p_col.max, pointMax)
def setUp(self): self.pointA = PointElement(2,2,2) self.pointB = PointElement(10,6,0)
def test_sub(self): pointSub = self.pointB - self.pointA sub_result = PointElement(8, 4, -2) self.assertEqual(pointSub, sub_result)
def test_add(self): pointSum = self.pointA + self.pointB sum_result = PointElement(12, 8, 2) self.assertEqual(pointSum, sum_result)
def test_init(self): point = PointElement() self.assertEqual(point.as_tuple, (0,0,0))
def test_eq(self): pointA = PointElement(2, 2, 2) pointB = PointElement(2, 2, 2) pointC = PointElement(0, 0, 0) self.assertEqual(pointA, pointB) self.assertNotEqual(pointA, pointC)