summaryrefslogtreecommitdiff
path: root/tests/basics/builtin_hash.py
AgeCommit message (Collapse)Author
2023-05-19tests/basics: Add more tests for hashing of various types.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2017-03-04tests/basic: Split tests into working with small ints and not working.Paul Sokolovsky
Tests which don't work with small ints are suffixed with _intbig.py. Some of these may still work with long long ints and need to be reclassified later.
2016-08-15tests/basics: Add more tuple tests to improve coverage testing.Damien George
2015-10-01tests: Add further tests for mpz code.Damien George
2015-05-12tests: Add further tests for class defining __hash__.Damien George
2015-05-12py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function.Damien George
Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as the operator argument. Hashing for int, str and bytes still go via fast-path in mp_unary_op since they are the most common objects which need to be hashed. This lead to quite a bit of code cleanup, and should be more efficient if anything. It saves 176 bytes code space on Thumb2, and 360 bytes on x86. The only loss is that the error message "unhashable type" is now the more generic "unsupported type for __hash__".
2015-05-05obj: Handle user instance hash based on Python adhoc rules.Paul Sokolovsky
User instances are hashable by default (using __hash__ inherited from "object"). But if __eq__ is defined and __hash__ not defined in particular class, instance is not hashable.
2015-01-29tests: Add some tests to improve coverage.Damien George
Used gcov to find some parts of vm.c, runtime.c, obj.c that were not covered by any tests. Still need to use gcov more thoroughly.
2014-11-15tests: Add test for hash of user defined class.Damien George