Exemplo n.º 1
0
 def test_convert_to_int_returns_error_for_zero_as_an_arg(self):
     """
     Test that zero is not accepted as an arg
     """
     integer_list = convert_to_int([1, 0])
     self.assertEqual(
         integer_list[1],
         "When entering integers ensure they are greater than 0",
         "Convert int did not throw an error when zero was passed",
     )
Exemplo n.º 2
0
 def test_convert_to_int_returns_error_for_non_integers(self):
     """
     Test that converting the numbers returns a [1, 100] if empty list is passed
     """
     integer_list = convert_to_int(["something"])
     self.assertEqual(
         integer_list[1],
         "Please enter integers only",
         "Convert to int did not return an error for non int value",
     )
Exemplo n.º 3
0
 def test_convert_to_int_returns_error_for_more_than_2_args(self):
     """
     Test that more than 2 args will result in error
     """
     integer_list = convert_to_int([1, 2, 3])
     self.assertEqual(
         integer_list[1],
         "You cannot enter more than 2 arguments",
         "Convert to int did not return an error for more than 2 args",
     )
Exemplo n.º 4
0
 def test_convert_to_int_returns_defaults(self):
     """
     Test that converting the numbers returns a [1, 100] if empty list is passed
     """
     integer_list = convert_to_int([])[0]
     print(integer_list)
     self.assertEqual(integer_list[0], 1,
                      "List did not start with the number 1")
     self.assertEqual(integer_list[1], 100,
                      "List did not end with the number 100")
Exemplo n.º 5
0
 def test_convert_to_int_returns_1_as_min_value_when_single_arg_is_provided(
         self):
     """
     Test that 1 is returned as the min value if one argument is passed
     """
     integer_list = convert_to_int([80])[0]
     self.assertEqual(
         integer_list[0],
         1,
         "Convert to int did not return a minimum value when provided with a single argument",
     )