def test_getEvent(self): # create distribution instance, normal distribution with mean 100, std 20 dist1 = Distribution('normal(100, 20, 1)') # the seed must be set AFTER creating the Distribution instances, because # the constructor invokes the RNG function one time to validate that it # can be called. np.random.seed(100) expected = [ 65.00469054, 106.85360807, 123.06071605, 94.95127927, 119.62641574, 110.28437683, 104.42359338, 78.59913339, 96.21008338, 105.10002889 ] for i in range(0, 10): with self.subTest(i=i): actual = dist1.getEvent() self.assertAlmostEqual(expected[i], actual)