def __init__(self, *args, **kwargs): NumericTestCase.__init__(self, *args, **kwargs) # Read data from external test data file. # (In this case, produced by numpy and Python 2.5.) location = self.get_data_location("support/test_data.zip") # Now read the data from that file. zf = zipfile.ZipFile(location, "r") self.data = pickle.loads(zf.read("data.pkl")) self.expected = pickle.loads(zf.read("results.pkl")) zf.close()
def __init__(self, *args, **kwargs): NumericTestCase.__init__(self, *args, **kwargs) self.func = stats.pvariance # Standard test data. self.data = [4.0, 7.0, 13.0, 16.0] self.expected = 22.5 # Exact population variance of self.data. # Test data for exact (uniform distribution) test: self.uniform_data = range(10000) self.uniform_expected = (10000**2 - 1)/12 # Expected result calculated by HP-48GX: self.hp_expected = 88349.2408884 # Scaling factor when you duplicate each data point: self.scale = 1.0
def __init__(self, *args, **kwargs): NumericTestCase.__init__(self, *args, **kwargs) self.xdata = [ 1 / 64, 1 / 32, 1 / 16, 1 / 8, 1 / 4, 1 / 2, 1, 3 / 2, 5 / 2, 7 / 2, 9 / 2, 11 / 2, 13 / 2, 15 / 2, 17 / 2, 19 / 2, ] self.ydata = [ 1 / 4, 1 / 2, 3 / 2, 1, 1 / 2, 3 / 2, 1, 5 / 4, 5 / 2, 7 / 4, 9 / 4, 11 / 4, 11 / 4, 7 / 4, 13 / 4, 17 / 4, ] assert len(self.xdata) == len(self.ydata) == 16
def __init__(self, *args, **kwargs): NumericTestCase.__init__(self, *args, **kwargs) self.func = stats.multivar.corr