File tree 3 files changed +16
-14
lines changed
3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 2
2
# Use of this source code is governed by a BSD-style
3
3
# license that can be found in the LICENSE file.
4
4
5
+ from libtest import assertRaises
6
+
5
7
doc = "abs"
6
8
assert abs (0 ) == 0
7
9
assert abs (10 ) == 10
@@ -151,6 +153,20 @@ def func(p):
151
153
ok = True
152
154
assert ok , "ValueError not raised"
153
155
156
+ doc = "hex"
157
+ assert hex ( 0 )== "0x0" , "hex(0)"
158
+ assert hex ( 1 )== "0x1" , "hex(1)"
159
+ assert hex (42 )== "0x2a" , "hex(42)"
160
+ assert hex ( - 0 )== "0x0" , "hex(-0)"
161
+ assert hex ( - 1 )== "-0x1" , "hex(-1)"
162
+ assert hex (- 42 )== "-0x2a" , "hex(-42)"
163
+ assert hex ( 1 << 64 ) == "0x10000000000000000" , "hex(1<<64)"
164
+ assert hex (- 1 << 64 ) == "-0x10000000000000000" , "hex(-1<<64)"
165
+ assert hex ( 1 << 128 ) == "0x100000000000000000000000000000000" , "hex(1<<128)"
166
+ assert hex (- 1 << 128 ) == "-0x100000000000000000000000000000000" , "hex(-1<<128)"
167
+ assertRaises (TypeError , hex , 10.0 ) ## TypeError: 'float' object cannot be interpreted as an integer
168
+ assertRaises (TypeError , hex , float (0 )) ## TypeError: 'float' object cannot be interpreted as an integer
169
+
154
170
doc = "iter"
155
171
cnt = 0
156
172
def f ():
File renamed without changes.
Original file line number Diff line number Diff line change 66
66
else :
67
67
assert False , "SyntaxError not raised"
68
68
69
- doc = "hex"
70
- assert True , hex ( 0 )== "0x0"
71
- assert True , hex ( 1 )== "0x1"
72
- assert True , hex (42 )== "0x2a"
73
- assert True , hex ( - 0 )== "0x0"
74
- assert True , hex ( - 1 )== "-0x1"
75
- assert True , hex (- 42 )== "-0x2a"
76
- assert True , hex ( 1 << 64 ) == "0x10000000000000000"
77
- assert True , hex (- 1 << 64 ) == "-0x10000000000000000"
78
- assert True , hex ( 1 << 128 ) == "0x100000000000000000000000000000000"
79
- assert True , hex (- 1 << 128 ) == "-0x100000000000000000000000000000000"
80
- assertRaises (TypeError , hex , 10.0 ) ## TypeError: 'float' object cannot be interpreted as an integer
81
- assertRaises (TypeError , hex , float (0 )) ## TypeError: 'float' object cannot be interpreted as an integer
82
-
83
69
doc = "isinstance"
84
70
class A :
85
71
pass
You can’t perform that action at this time.
0 commit comments