Esempio n. 1
0
 def test_randint(self):
     saw = {}
     for _ in range(50):
         result = random.randint(0, 1)
         count = saw.get(result, 0)
         saw[result] = count + 1
     self.assertEqual(len(saw), 2)
     for n, c in saw.iteritems():
         self.assertTrue(n in [0,1])
         self.assertTrue(c > 10)
Esempio n. 2
0
 def test_randint(self):
     saw = {}
     for _ in range(50):
         result = random.randint(0, 1)
         count = saw.get(result, 0)
         saw[result] = count + 1
     self.assertEqual(len(saw), 2)
     for n, c in saw.iteritems():
         self.assertTrue(n in [0, 1])
         self.assertTrue(c > 10)
Esempio n. 3
0
    def test_randint_range(self):
        min = 30
        max = 3911
        saw = {}
        for _ in range(500):
            result = random.randint(min, max)
            count = saw.get(result, 0)
            saw[result] = count + 1

        for n, c in saw.iteritems():
            self.assertTrue(n >= min)
            self.assertTrue(n <= max)
Esempio n. 4
0
    def test_randint_range(self):
        min = 30
        max = 3911
        saw = {}
        for _ in range(500):
            result = random.randint(min, max)
            count = saw.get(result, 0)
            saw[result] = count + 1

        for n, c in saw.iteritems():
            self.assertTrue(n >= min)
            self.assertTrue(n <= max)