def test_check_subsample_power_inputs_bootstrap_counts(self): with self.assertRaises(ValueError): _check_subsample_power_inputs(test=self.f, samples=[np.ones((3)), np.ones((5))], counts=self.counts, bootstrap=False)
def test_check_subsample_power_inputs_matched_mode(self): with self.assertRaises(ValueError): _check_subsample_power_inputs(test=self.f, samples=[np.ones((2)), np.ones((5))], counts=self.counts, draw_mode="matched")
def test_check_subsample_power_inputs_draw_mode_error(self): with self.assertRaises(ValueError): _check_subsample_power_inputs(test=self.f, samples=[np.ones((2)), np.ones((5))], counts=self.counts, draw_mode="Alice Price Healy")
def test_check_subsample_power_inputs_test(self): # Defines a test function def test(x): return 'Hello World!' with self.assertRaises(TypeError): _check_subsample_power_inputs(test=test, samples=self.samps, counts=self.counts)
def test_check_sample_power_inputs(self): # Defines the know returns known_num_p = 1 known_ratio = np.ones((2)) # Runs the code for the returns test_ratio, test_num_p = \ _check_subsample_power_inputs(test=self.f, samples=self.samps, counts=self.counts, ) # Checks the returns are sane self.assertEqual(known_num_p, test_num_p) npt.assert_array_equal(known_ratio, test_ratio)
def test_check_subsample_power_inputs_bootstrap_error(self): with self.assertRaises(ValueError): _check_subsample_power_inputs(test=self.f, samples=self.samps, counts=np.arange(10, 1000, 10), bootstrap=False)
def test_check_subsample_power_inputs_ratio(self): with self.assertRaises(ValueError): _check_subsample_power_inputs(test=self.f, samples=self.samps, counts=self.counts, ratio=np.array([1, 2, 3]))
def test_check_subsample_power_inputs_low_counts(self): with self.assertRaises(ValueError): _check_subsample_power_inputs(test=self.f, samples=self.samps, counts=np.arange(-5, 0) )
def test_check_subsample_power_inputs_low_counts(self): with self.assertRaises(ValueError): _check_subsample_power_inputs(test=self.f, samples=self.samps, counts=np.arange(-5, 0))