9
9
from test .support import import_helper
10
10
11
11
_testcapi = import_helper .import_module ('_testcapi' )
12
+ _testlimitedcapi = import_helper .import_module ('_testlimitedcapi' )
12
13
13
14
NULL = None
14
15
29
30
class CAPIFloatTest (unittest .TestCase ):
30
31
def test_check (self ):
31
32
# Test PyFloat_Check()
32
- check = _testcapi .float_check
33
+ check = _testlimitedcapi .float_check
33
34
34
35
self .assertTrue (check (4.25 ))
35
36
self .assertTrue (check (FloatSubclass (4.25 )))
@@ -41,7 +42,7 @@ def test_check(self):
41
42
42
43
def test_checkexact (self ):
43
44
# Test PyFloat_CheckExact()
44
- checkexact = _testcapi .float_checkexact
45
+ checkexact = _testlimitedcapi .float_checkexact
45
46
46
47
self .assertTrue (checkexact (4.25 ))
47
48
self .assertFalse (checkexact (FloatSubclass (4.25 )))
@@ -53,7 +54,7 @@ def test_checkexact(self):
53
54
54
55
def test_fromstring (self ):
55
56
# Test PyFloat_FromString()
56
- fromstring = _testcapi .float_fromstring
57
+ fromstring = _testlimitedcapi .float_fromstring
57
58
58
59
self .assertEqual (fromstring ("4.25" ), 4.25 )
59
60
self .assertEqual (fromstring (b"4.25" ), 4.25 )
@@ -72,13 +73,13 @@ def test_fromstring(self):
72
73
73
74
def test_fromdouble (self ):
74
75
# Test PyFloat_FromDouble()
75
- fromdouble = _testcapi .float_fromdouble
76
+ fromdouble = _testlimitedcapi .float_fromdouble
76
77
77
78
self .assertEqual (fromdouble (4.25 ), 4.25 )
78
79
79
80
def test_asdouble (self ):
80
81
# Test PyFloat_AsDouble()
81
- asdouble = _testcapi .float_asdouble
82
+ asdouble = _testlimitedcapi .float_asdouble
82
83
83
84
class BadFloat3 :
84
85
def __float__ (self ):
@@ -109,19 +110,19 @@ def __float__(self):
109
110
110
111
def test_getinfo (self ):
111
112
# Test PyFloat_GetInfo()
112
- getinfo = _testcapi .float_getinfo
113
+ getinfo = _testlimitedcapi .float_getinfo
113
114
114
115
self .assertEqual (getinfo (), sys .float_info )
115
116
116
117
def test_getmax (self ):
117
118
# Test PyFloat_GetMax()
118
- getmax = _testcapi .float_getmax
119
+ getmax = _testlimitedcapi .float_getmax
119
120
120
121
self .assertEqual (getmax (), sys .float_info .max )
121
122
122
123
def test_getmin (self ):
123
124
# Test PyFloat_GetMax()
124
- getmin = _testcapi .float_getmin
125
+ getmin = _testlimitedcapi .float_getmin
125
126
126
127
self .assertEqual (getmin (), sys .float_info .min )
127
128
0 commit comments