Exemplo n.º 1
0
 def test_number_of_arguments_is_greater_than_arity_fun_with_indefinite_number_of_args(
         self):
     with self.assertRaises(TypeError):
         uncurry_explicit(curried_fun_with_indefinite_number_of_args,
                          5)(1, 2, 3, 4, 5, 6, 7)
Exemplo n.º 2
0
 def test_number_of_arguments_is_greater_than_arity_fun_without_args(self):
     with self.assertRaises(TypeError):
         uncurry_explicit(curried_fun_without_args, 0)(1)
Exemplo n.º 3
0
 def test_number_of_arguments_is_greater_than_arity_fun_with_several_args(
         self):
     with self.assertRaises(TypeError):
         uncurry_explicit(curried_fun_with_several_args, 3)("a", "b", "c",
                                                            "d")
Exemplo n.º 4
0
 def test_negative_arity(self):
     with self.assertRaises(ValueError):
         uncurry_explicit(curried_fun_with_several_args, -10)()
Exemplo n.º 5
0
 def test_indefinite_number_of_args(self):
     return self.assertEqual(
         uncurry_explicit(curried_fun_with_indefinite_number_of_args,
                          5)(6, 7, 8, 9, 0),
         curried_fun_with_indefinite_number_of_args(6, 7, 8, 9, 0),
     )
Exemplo n.º 6
0
 def test_several_args(self):
     return self.assertEqual(
         uncurry_explicit(curried_fun_with_several_args, 3)("a", "b", "c"),
         fun_with_several_args("a", "b", "c"))
Exemplo n.º 7
0
 def test_one_arg(self):
     return self.assertEqual(
         uncurry_explicit(curried_fun_with_one_arg, 1)(15),
         fun_with_one_arg(15))
Exemplo n.º 8
0
 def test_without_args(self):
     return self.assertEqual(
         uncurry_explicit(curried_fun_without_args, 0)(),
         fun_without_args())