예제 #1
0
 def test_add_point(self):
     ssf = SimpleSizeFunction(-2, 5)
     ssf.add_point(1, 2)
     ap = AP(1, 2)
     self.assertIn(ap, ssf.get_points())
     self.assertRaises(ValueError, ssf.add_point, -3, 2)
     self.assertRaises(ValueError, ssf.add_point, -1, 6)
     ssf.add_point(1.1, 2.2)
     self.assertIn(AP(1.1, 2.2), ssf.points)
     ssf.add_point(1, 2)
     self.assertEqual(2, ssf.points.count(ap))
예제 #2
0
 def test_add_point(self):
     ssf = SimpleSizeFunction(-2, 5)
     ssf.add_point(1, 2)
     ap = AP(1, 2)
     self.assertIn(ap, ssf.get_points())
     self.assertRaises(ValueError, ssf.add_point, -3, 2)
     self.assertRaises(ValueError, ssf.add_point, -1, 6)
     ssf.add_point(1.1, 2.2)
     self.assertIn(AP(1.1, 2.2), ssf.points)
     ssf.add_point(1, 2)
     self.assertEqual(2, ssf.points.count(ap))
예제 #3
0
 def test_equal(self):
     ssf1 = SimpleSizeFunction(-2, 5)
     ssf1.add_point(1, 2)
     ssf2 = SimpleSizeFunction(-2, 5)
     ssf2.add_point(1, 2)
     self.assertEqual(ssf1, ssf2)
     ssf2.add_point(2, 3)
     self.assertNotEqual(ssf1, ssf2)
     ssf1.add_point(2, 3)
     self.assertEqual(ssf1, ssf2)
     ssf2.add_point(2, 3)
     self.assertNotEqual(ssf1, ssf2)
     ssf1.add_point(2, 3)
     self.assertEqual(ssf1, ssf2)
     ssf1 = SimpleSizeFunction(0)
     ssf2 = SimpleSizeFunction(0)
     self.assertEqual(ssf1, ssf2)
     ssf1 = SimpleSizeFunction(0, 3)
     ssf2 = SimpleSizeFunction(0, 4)
     self.assertNotEqual(ssf1, ssf2)
     ssf2 = SimpleSizeFunction(0)
     self.assertNotEqual(ssf1, ssf2)
     ssf1 = SimpleSizeFunction(0)
     ssf2 = SimpleSizeFunctionOld(0)
     self.assertEqual(ssf1, ssf2)
     self.assertEqual(ssf2, ssf1)
     ssf1 = SimpleSizeFunction(0, 3)
     self.assertNotEqual(ssf1, ssf2)
     self.assertNotEqual(ssf2, ssf1)
예제 #4
0
 def test_equal(self):
     ssf1 = SimpleSizeFunction(-2, 5)
     ssf1.add_point(1, 2)
     ssf2 = SimpleSizeFunction(-2, 5)
     ssf2.add_point(1, 2)
     self.assertEqual(ssf1, ssf2)
     ssf2.add_point(2, 3)
     self.assertNotEqual(ssf1, ssf2)
     ssf1.add_point(2, 3)
     self.assertEqual(ssf1, ssf2)
     ssf2.add_point(2, 3)
     self.assertNotEqual(ssf1, ssf2)
     ssf1.add_point(2, 3)
     self.assertEqual(ssf1, ssf2)
     ssf1 = SimpleSizeFunction(0)
     ssf2 = SimpleSizeFunction(0)
     self.assertEqual(ssf1, ssf2)
     ssf1 = SimpleSizeFunction(0, 3)
     ssf2 = SimpleSizeFunction(0, 4)
     self.assertNotEqual(ssf1, ssf2)
     ssf2 = SimpleSizeFunction(0)
     self.assertNotEqual(ssf1, ssf2)
     ssf1 = SimpleSizeFunction(0)
     ssf2 = SimpleSizeFunctionOld(0)
     self.assertEqual(ssf1, ssf2)
     self.assertEqual(ssf2, ssf1)
     ssf1 = SimpleSizeFunction(0, 3)
     self.assertNotEqual(ssf1, ssf2)
     self.assertNotEqual(ssf2, ssf1)