def test_number_generator_zero(self):
        """Test number_generator function with zero.

        if zero is NOT in the list made from the function
        result is expected True
        """
        random_numbers = lotto.number_generator()
        self.assertNotIn(0, random_numbers)
    def test_number_generator_length(self):
        """Test number_generator function if the length is always the same value as 6

        if the length of list is always 6
        result is expected True
        """
        random_numbers = lotto.number_generator()
        self.assertTrue(len(random_numbers) == 6)
 def test_number_generator_integer(self):
     random_numbers = number_generator()
     self.assertTrue(random_numbers[0] == int(random_numbers[0])
                     and random_numbers[1] == int(random_numbers[1])
                     and random_numbers[2] == int(random_numbers[2])
                     and random_numbers[3] == int(random_numbers[3])
                     and random_numbers[4] == int(random_numbers[4])
                     and random_numbers[5] == int(random_numbers[5]))
    def test_number_generator_fifty(self):
        """Test number_generator function with fifty.

        if fifty is NOT in the list made from the function
        result is expected True
        """
        random_numbers = lotto.number_generator()
        self.assertNotIn(50, random_numbers)
    def test_number_generator_positive_integer(self):
        """Test number_generator function with the number greater than 0, less than 50.

        if sample number from the random number list is in the range
        result is expected True
        """
        random_numbers = lotto.number_generator()
        self.assertTrue(0 < random_numbers[3] < 50)
Esempio n. 6
0
    def test_number_generator_sorted(self):
        """Produce True to determine if the next element is greater than the first."""
        lotto_number = lotto.number_generator()

        self.assertTrue(lotto_number[0] < lotto_number[1])
        self.assertTrue(lotto_number[1] < lotto_number[2])
        self.assertTrue(lotto_number[2] < lotto_number[3])
        self.assertTrue(lotto_number[3] < lotto_number[4])
        self.assertTrue(lotto_number[4] < lotto_number[5])
 def test_numbers_in_range(self):
     self.assertTrue(0 <= lotto.number_generator()[0] < 50)
     self.assertTrue(0 <= lotto.number_generator()[1] < 50)
     self.assertTrue(0 <= lotto.number_generator()[2] < 50)
     self.assertTrue(0 <= lotto.number_generator()[3] < 50)
     self.assertTrue(0 <= lotto.number_generator()[4] < 50)
     self.assertTrue(0 <= lotto.number_generator()[5] < 50)
 def test_number_generator_range(self):
     lotto_range = [
         1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
         20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
         37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49
     ]
     random_numbers = number_generator()
     self.assertTrue(random_numbers[0] in lotto_range
                     and random_numbers[1] in lotto_range
                     and random_numbers[2] in lotto_range
                     and random_numbers[3] in lotto_range
                     and random_numbers[4] in lotto_range
                     and random_numbers[5] in lotto_range)
Esempio n. 9
0
    def test_number_generator_unique(self):
        """Produce True to determine whether element only appears once in list."""
        lotto_number = lotto.number_generator()

        lotto_one = lotto.number_generator()[0]
        lotto_two = lotto.number_generator()[1]
        lotto_three = lotto.number_generator()[2]
        lotto_four = lotto.number_generator()[3]
        lotto_five = lotto.number_generator()[4]
        lotto_six = lotto.number_generator()[5]

        self.assertTrue(1, lotto_number.count(lotto_one))
        self.assertTrue(1, lotto_number.count(lotto_two))
        self.assertTrue(1, lotto_number.count(lotto_three))
        self.assertTrue(1, lotto_number.count(lotto_four))
        self.assertTrue(1, lotto_number.count(lotto_five))
        self.assertTrue(1, lotto_number.count(lotto_six))
Esempio n. 10
0
    def test_number_generator_range(self):
        """Produce True to determine if element in list is within range."""
        my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
                   11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
                   21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
                   31, 32, 33, 34, 35, 36, 37, 38, 49, 41,
                   42, 43, 44, 45, 46, 47, 48, 49]

        lotto_one = lotto.number_generator()[0]
        lotto_two = lotto.number_generator()[1]
        lotto_three = lotto.number_generator()[2]
        lotto_four = lotto.number_generator()[3]
        lotto_five = lotto.number_generator()[4]
        lotto_six = lotto.number_generator()[5]

        self.assertTrue(lotto_one in my_list)
        self.assertTrue(lotto_two in my_list)
        self.assertTrue(lotto_three in my_list)
        self.assertTrue(lotto_four in my_list)
        self.assertTrue(lotto_five in my_list)
        self.assertTrue(lotto_six in my_list)
Esempio n. 11
0
 def test_number_generator_integer_true(self):
     "Produce type to determine if all elements in list can be summed together."
     self.assertEqual(int, type(sum(lotto.number_generator())))
Esempio n. 12
0
 def test_number_generator_length(self):
     """Produce length of list to determine whether there are six elements."""
     self.assertEqual(6, len(lotto.number_generator()))
 def test_list_length(self):
     self.assertTrue(len(lotto.number_generator()) == 6)
 def test_number_generator_length(self):
     self.assertEqual(6, len(number_generator()))
Esempio n. 15
0
 def test_number_generator_list(self):
     """Produce True if type returned is a list."""
     self.assertTrue(type(lotto.number_generator() is list))
 def test_number_generator_sorted(self):
     random_numbers = number_generator()
     self.assertEqual(sorted(random_numbers), random_numbers)
 def test_number_generator_unique(self):
     self.assertEqual(6, len(set(number_generator())))
Esempio n. 18
0
from unittest import TestCase
import lotto

lottery_numbers = lotto.number_generator()
lucky_list = [
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
    22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
    41, 42, 43, 44, 45, 46, 47, 48, 49
]


class TestNumberGenerator(TestCase):
    def test_number_generator_number_in_list(self):
        self.assertIn(lottery_numbers[0], lucky_list)
        self.assertIn(lottery_numbers[1], lucky_list)
        self.assertIn(lottery_numbers[2], lucky_list)
        self.assertIn(lottery_numbers[3], lucky_list)
        self.assertIn(lottery_numbers[4], lucky_list)
        self.assertIn(lottery_numbers[5], lucky_list)

    def test_number_generator_numbers_unique(self):
        self.assertIsNot(lottery_numbers[0], lottery_numbers[1])
        self.assertIsNot(lottery_numbers[0], lottery_numbers[2])
        self.assertIsNot(lottery_numbers[0], lottery_numbers[3])
        self.assertIsNot(lottery_numbers[0], lottery_numbers[4])
        self.assertIsNot(lottery_numbers[0], lottery_numbers[5])
        self.assertIsNot(lottery_numbers[1], lottery_numbers[2])
        self.assertIsNot(lottery_numbers[1], lottery_numbers[3])
        self.assertIsNot(lottery_numbers[1], lottery_numbers[4])
        self.assertIsNot(lottery_numbers[1], lottery_numbers[5])
        self.assertIsNot(lottery_numbers[2], lottery_numbers[3])
 def test_unique_numbers(self):
     self.assertTrue(
         lotto.number_generator()[0] != lotto.number_generator()[1] !=
         lotto.number_generator()[2] != lotto.number_generator()[3] !=
         lotto.number_generator()[4] != lotto.number_generator()[5])