Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
677fb310
Commit
677fb310
authored
Apr 04, 2017
by
Damien George
Browse files
tests/float: Add tests for hashing float and complex numbers.
parent
19f2e47d
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/float/builtin_float_hash.py
0 → 100644
View file @
677fb310
# test builtin hash function with float args
# these should hash to an integer with a specific value
for
val
in
(
'0.0'
,
'1.0'
,
'2.0'
,
'-12.0'
,
'12345.0'
,
):
print
(
val
,
hash
(
float
(
val
)))
# just check that these values are hashable
for
val
in
(
'0.1'
,
'-0.1'
,
'10.3'
,
'inf'
,
'-inf'
,
'nan'
,
):
print
(
val
,
type
(
hash
(
float
(
val
))))
tests/float/complex1.py
View file @
677fb310
...
...
@@ -41,6 +41,10 @@ print(1j == 1j)
print
(
abs
(
1j
))
print
(
"%.5g"
%
abs
(
1j
+
2
))
# builtin hash
print
(
hash
(
1
+
0j
))
print
(
type
(
hash
(
1j
)))
# float on lhs should delegate to complex
print
(
1.2
+
3j
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment