From 4df85e49d48a76246d97383ac6a5d63e1ce2be60 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 15 Nov 2014 18:30:01 +0000 Subject: [PATCH] tests: Add test for hash of user defined class. --- tests/basics/builtin_hash.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/basics/builtin_hash.py diff --git a/tests/basics/builtin_hash.py b/tests/basics/builtin_hash.py new file mode 100644 index 0000000000..c4c7019b47 --- /dev/null +++ b/tests/basics/builtin_hash.py @@ -0,0 +1,10 @@ +# test builtin hash function + +class A: + def __hash__(self): + return 123 + def __repr__(self): + return "a instance" + +print(hash(A())) +print({A():1})