Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit fde5435

Browse files
committed
tests/float: Convert "sys.exit()" to "raise SystemExit".
The latter is shorter and simpler because it doesn't require importing the sys module.
1 parent d80c951 commit fde5435

13 files changed

+13
-26
lines changed

tests/float/array_construct.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
try:
44
from array import array
55
except ImportError:
6-
import sys
76
print("SKIP")
8-
sys.exit()
7+
raise SystemExit
98

109
print(array('f', array('h', [1, 2])))
1110
print(array('d', array('f', [1, 2])))

tests/float/builtin_float_minmax.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
min
44
max
55
except:
6-
import sys
76
print("SKIP")
8-
sys.exit()
7+
raise SystemExit
98

109
print(min(0,1.0))
1110
print(min(1.0,0))

tests/float/bytearray_construct.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
try:
44
from array import array
55
except ImportError:
6-
import sys
76
print("SKIP")
8-
sys.exit()
7+
raise SystemExit
98

109
print(bytearray(array('f', [1, 2.3])))

tests/float/bytes_construct.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
try:
44
from array import array
55
except ImportError:
6-
import sys
76
print("SKIP")
8-
sys.exit()
7+
raise SystemExit
98

109
print(bytes(array('f', [1, 2.3])))

tests/float/cmath_fun.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
from cmath import *
55
except ImportError:
66
print("SKIP")
7-
import sys
8-
sys.exit()
7+
raise SystemExit
98

109
# make sure these constants exist in cmath
1110
print("%.5g" % e)

tests/float/cmath_fun_special.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
log10
66
except (ImportError, NameError):
77
print("SKIP")
8-
import sys
9-
sys.exit()
8+
raise SystemExit
109

1110
test_values_non_zero = []
1211
base_values = (0.0, 0.5, 1.2345, 10.)

tests/float/float_array.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
try:
22
from array import array
33
except ImportError:
4-
import sys
54
print("SKIP")
6-
sys.exit()
5+
raise SystemExit
76

87
def test(a):
98
print(a)

tests/float/float_struct.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
except:
66
import struct
77
except ImportError:
8-
import sys
98
print("SKIP")
10-
sys.exit()
9+
raise SystemExit
1110

1211
i = 1. + 1/2
1312
# TODO: it looks like '=' format modifier is not yet supported

tests/float/math_fun.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
from math import *
55
except ImportError:
66
print("SKIP")
7-
import sys
8-
sys.exit()
7+
raise SystemExit
98

109
test_values = [-100., -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.]
1110
test_values_small = [-10., -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 10.] # so we don't overflow 32-bit precision

tests/float/math_fun_bool.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
from math import isfinite, isnan, isinf
55
except ImportError:
66
print("SKIP")
7-
import sys
8-
sys.exit()
7+
raise SystemExit
98

109
test_values = [1, 0, -1, 1.0, 0.0, -1.0, float('NaN'), float('Inf'),
1110
-float('NaN'), -float('Inf')]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy