Exemplo n.º 1
0
 def test_run_fuction_with_type_hint(self):
     python_version = sys.version_info[0]
     # type hints are python 3 only
     if python_version == 3:
         scope = {}
         exec('def f_with_type_hint() -> None: return', scope)
         f_with_type_hint = scope['f_with_type_hint']
         self.assertIsNone(LambdaHandler.run_function(f_with_type_hint, 'e', 'c'))
Exemplo n.º 2
0
 def test_run_fuction_with_type_hint(self):
     python_version = sys.version_info[0]
     # type hints are python 3 only
     if python_version == 3:
         scope = {}
         exec('def f_with_type_hint() -> None: return', scope)
         f_with_type_hint = scope['f_with_type_hint']
         self.assertIsNone(LambdaHandler.run_function(f_with_type_hint, 'e', 'c'))
Exemplo n.º 3
0
    def test_run_function(self):
        self.assertIsNone(LambdaHandler.run_function(no_args, 'e', 'c'))
        self.assertEqual(LambdaHandler.run_function(one_arg, 'e', 'c'), 'e')
        self.assertEqual(LambdaHandler.run_function(two_args, 'e', 'c'), ('e', 'c'))
        self.assertEqual(LambdaHandler.run_function(var_args, 'e', 'c'), ('e', 'c'))
        self.assertEqual(LambdaHandler.run_function(var_args_with_one, 'e', 'c'), ('e', 'c'))

        try:
            LambdaHandler.run_function(unsupported, 'e', 'c')
            self.fail('Exception expected')
        except RuntimeError as e:
            pass
Exemplo n.º 4
0
    def test_run_function(self):
        self.assertIsNone(LambdaHandler.run_function(no_args, 'e', 'c'))
        self.assertEqual(LambdaHandler.run_function(one_arg, 'e', 'c'), 'e')
        self.assertEqual(LambdaHandler.run_function(two_args, 'e', 'c'), ('e', 'c'))
        self.assertEqual(LambdaHandler.run_function(var_args, 'e', 'c'), ('e', 'c'))
        self.assertEqual(LambdaHandler.run_function(var_args_with_one, 'e', 'c'), ('e', 'c'))

        try:
            LambdaHandler.run_function(unsupported, 'e', 'c')
            self.fail('Exception expected')
        except RuntimeError as e:
            pass
Exemplo n.º 5
0
    def test_run_function(self):
        self.assertIsNone(LambdaHandler.run_function(no_args, "e", "c"))
        self.assertEqual(LambdaHandler.run_function(one_arg, "e", "c"), "e")
        self.assertEqual(LambdaHandler.run_function(two_args, "e", "c"), ("e", "c"))
        self.assertEqual(LambdaHandler.run_function(var_args, "e", "c"), ("e", "c"))
        self.assertEqual(
            LambdaHandler.run_function(var_args_with_one, "e", "c"), ("e", "c")
        )

        try:
            LambdaHandler.run_function(unsupported, "e", "c")
            self.fail("Exception expected")
        except RuntimeError as e:
            pass
Exemplo n.º 6
0
 def test_run_fuction_with_type_hint(self):
     scope = {}
     exec('def f_with_type_hint() -> None: return', scope)
     f_with_type_hint = scope['f_with_type_hint']
     self.assertIsNone(
         LambdaHandler.run_function(f_with_type_hint, 'e', 'c'))
Exemplo n.º 7
0
 def test_run_fuction_with_type_hint(self):
     scope = {}
     exec("def f_with_type_hint() -> None: return", scope)
     f_with_type_hint = scope["f_with_type_hint"]
     self.assertIsNone(LambdaHandler.run_function(f_with_type_hint, "e", "c"))