From 677fb3101525bc655d9fd548b8c2cecfc8deefd2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 4 Apr 2017 12:14:34 +1000 Subject: tests/float: Add tests for hashing float and complex numbers. --- tests/float/builtin_float_hash.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/float/builtin_float_hash.py (limited to 'tests/float/builtin_float_hash.py') diff --git a/tests/float/builtin_float_hash.py b/tests/float/builtin_float_hash.py new file mode 100644 index 000000000..ba6b63907 --- /dev/null +++ b/tests/float/builtin_float_hash.py @@ -0,0 +1,22 @@ +# 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)))) -- cgit v1.2.3