1
# Copyright 2014, Kay Hayen, mailto:kay.hayen@gmail.com
3
# Python tests originally created or extracted from other peoples work. The
4
# parts were too small to be protected.
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
20
# Find common code relative in file system. Not using packages for test stuff.
25
os.path.dirname(os.path.abspath(__file__)),
30
from test_common import (
31
executeReferenceChecked,
36
if not hasattr(sys, "gettotalrefcount"):
37
my_print("Warning, using non-debug Python makes this test ineffective.")
38
sys.gettotalrefcount = lambda : 0
42
# Python2 only syntax things are here.
43
def simpleFunction1():
45
raise TypeError, (3,x,x,x)
49
def simpleFunction2():
51
raise ValueError(1,2,3), ValueError(1,2,3)
55
def simpleFunction3():
57
raise ValueError, 2, None
61
def simpleFunction4():
63
raise ValueError, 2, 3
67
def simpleFunction5():
68
def nested_args_function((a,b), c):
71
nested_args_function((1, 2), 3)
73
def simpleFunction6():
74
def nested_args_function((a,b), c):
78
nested_args_function((1,), 3)
82
def simpleFunction7():
83
def nested_args_function((a,b), c):
87
nested_args_function((1, 2, 3), 3)
92
# These need stderr to be wrapped.
98
result = executeReferenceChecked(
99
prefix = "simpleFunction",
101
tests_skipped = tests_skipped,
102
tests_stderr = tests_stderr
105
sys.exit(0 if result else 1)