MCPcopy
hub / github.com/python-attrs/attrs / test_hash_default

Method test_hash_default

tests/test_dunders.py:605–617  ·  view source on GitHub ↗

Classes are not hashable by default.

(self)

Source from the content-addressed store, hash-verified

603 assert hash(a) != hash(b)
604
605 def test_hash_default(self):
606 """
607 Classes are not hashable by default.
608 """
609 C = make_class("C", {})
610
611 with pytest.raises(TypeError) as e:
612 hash(C())
613
614 assert e.value.args[0] in (
615 "'C' objects are unhashable", # PyPy
616 "unhashable type: 'C'", # CPython
617 )
618
619 def test_cache_hashing(self):
620 """

Callers

nothing calls this directly

Calls 2

make_classFunction · 0.90
CClass · 0.70

Tested by

no test coverage detected