Add regression test for false positive result.

This commit is contained in:
Kevin Backhouse
2019-01-17 16:22:19 +00:00
parent 28261d6787
commit 5fc056beb3

View File

@@ -216,3 +216,21 @@ def not_dup_key():
u"😆" : 3
}
# Lookup of unhashable object triggers TypeError, but the
# exception is caught, so it's not a bug. This used to be
# a false positive of the HashedButNoHash query.
def func():
unhash = list()
try:
hash(unhash)
except TypeError:
return 1
return 0
def func():
mapping = dict(); unhash = list()
try:
mapping[unhash]
except TypeError:
return 1
return 0