def test_distribution(self): """ Test Case to ensure the distribution of groups is close to uniform. Note: This test MAY fail. It is entirely possible, with a probability of :math:`2^{-n}` where :math:`n` is the number of subjects to randomize """ result = randomization.weis_urn(100000) percent_group_1 = (float(sum([value == 1 for value in result])) / float(len(result))) self.assertTrue(percent_group_1 > 0.48) self.assertTrue(percent_group_1 < 0.52)
def test_n_groups(self): """ Test Case to ensure the correct number of groups are output""" result = randomization.weis_urn(100) self.assertEqual(len(set(result)), 2)
def test_length(self): """ Test Case to ensure the correct number of subjects are output""" result = randomization.weis_urn(100) self.assertEqual(len(result), 100)