def test_pimf_membership_function(self): self.assertEqual(pimf.pimf(0.0, [1.0, 4.0, 5.0, 10.0]), 0.0) self.assertEqual(pimf.pimf(1.0, [1.0, 4.0, 5.0, 10.0]), 0.0) self.assertEqual(pimf.pimf(4.0, [1.0, 4.0, 5.0, 10.0]), 1.0) self.assertEqual(pimf.pimf(5.0, [1.0, 4.0, 5.0, 10.0]), 1.0) self.assertEqual(pimf.pimf(10.0, [1.0, 4.0, 5.0, 10.0]), 0.0) self.assertEqual(pimf.pimf(3.0, [5.0, 10.0, 15.0, 20.0]), 0.0) self.assertEqual(pimf.pimf(5.0, [5.0, 10.0, 15.0, 20.0]), 0.0) self.assertEqual(pimf.pimf(10.0, [5.0, 10.0, 15.0, 20.0]), 1.0) self.assertEqual(pimf.pimf(21.0, [5.0, 10.0, 15.0, 20.0]), 0.0) self.assertEqual(pimf.pimf(15.0, [5.0, 10.0, 15.0, 20.0]), 1.0)
def test_pimf16_membership_function(self): self.assertAlmostEqual(pimf.pimf(0.4, [0.0, 1.0, 1.0, 0.0]), 0.320, places=3)
def test_pimf2_membership_function(self): self.assertEqual(pimf.pimf(1.0, [1.0, 4.0, 5.0, 10.0]), 0.0)
def test_pimf15_membership_function(self): self.assertAlmostEqual(pimf.pimf(0.5, [0.0, 1.0, 1.0, 0.0]), 0.5, places=2)
def test_pimf14_membership_function(self): self.assertAlmostEqual(pimf.pimf(5, [6.0, 4.0, 10.0, 5.0]), 1, places=2)
def test_pimf13_membership_function(self): self.assertAlmostEqual(pimf.pimf(3.5, [1.0, 4.0, 8.0, 13.0]), 0.94, places=2)
def test_pimf11_membership_function(self): self.assertRaises(TypeError, lambda: pimf.pimf(1, [1, 4.0, 5.0, 10.0]))
def test_pimf10_membership_function(self): self.assertRaises(TypeError, lambda: pimf.pimf(1.0, []))