示例#1
0
 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)
示例#2
0
 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")
示例#3
0
 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")
示例#4
0
 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)
示例#5
0
    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)
示例#6
0
 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)
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
 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]))
示例#10
0
 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)
示例#11
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)
                                       )
示例#12
0
 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")
示例#13
0
 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")
示例#14
0
 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)
示例#15
0
 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]))
示例#16
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))