mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
Add test that ensures hash([]) and hash({}) raise TypeError.
This commit is contained in:
parent
41c3244875
commit
0c6614c789
1 changed files with 6 additions and 0 deletions
|
|
@ -267,6 +267,12 @@ if not hash(1) == hash(1L) == hash(1.0): raise TestFailed, 'numeric hash()'
|
||||||
hash('spam')
|
hash('spam')
|
||||||
hash((0,1,2,3))
|
hash((0,1,2,3))
|
||||||
def f(): pass
|
def f(): pass
|
||||||
|
try: hash([])
|
||||||
|
except TypeError: pass
|
||||||
|
else: raise TestFailed, "hash([]) should raise an exception"
|
||||||
|
try: hash({})
|
||||||
|
except TypeError: pass
|
||||||
|
else: raise TestFailed, "hash({}) should raise an exception"
|
||||||
|
|
||||||
print 'hex'
|
print 'hex'
|
||||||
if hex(16) != '0x10': raise TestFailed, 'hex(16)'
|
if hex(16) != '0x10': raise TestFailed, 'hex(16)'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue