def test_subsample_paired_power_interval_error(self): with self.assertRaises(ValueError): subsample_paired_power(self.f, self.meta, cat='INT', control_cats=['SEX', 'AGE'], min_observations=2, counts_interval=12, min_counts=5, max_counts=7)
def test_subsample_paired_power_multi_p(self): def f(x): return np.array([0.5, 0.5, 0.005]) cat = 'INT' control_cats = ['SEX'] # Tests for the control cats test_p, test_c = subsample_paired_power(f, meta=self.meta, cat=cat, control_cats=control_cats, counts_interval=1, num_iter=10, num_runs=2) self.assertEqual(test_p.shape, (2, 4, 3))
def test_subsample_paired_power(self): known_c = np.array([1, 2, 3, 4]) # Sets up the handling values cat = 'INT' control_cats = ['SEX'] # Tests for the control cats test_p, test_c = subsample_paired_power(self.meta_f, meta=self.meta, cat=cat, control_cats=control_cats, counts_interval=1, num_iter=10, num_runs=2) # Test the output shapes are sane self.assertEqual(test_p.shape, (2, 4)) npt.assert_array_equal(known_c, test_c)
def test_subsample_paired_power_min_observations_error(self): with self.assertRaises(ValueError): subsample_paired_power(self.f, self.meta, cat=self.cat, control_cats=self.control_cats)