MCPcopy Index your code
hub / github.com/python/cpython / test_hash_method_nan

Method test_hash_method_nan

Lib/test/test_decimal.py:1988–1999  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1986 self.assertEqual(hashit(Decimal(x)), hashit(x))
1987
1988 def test_hash_method_nan(self):
1989 Decimal = self.decimal.Decimal
1990 self.assertRaises(TypeError, hash, Decimal('sNaN'))
1991 value = Decimal('NaN')
1992 self.assertEqual(hash(value), object.__hash__(value))
1993 class H:
1994 def __hash__(self):
1995 return 42
1996 class D(Decimal, H):
1997 pass
1998 value = D('NaN')
1999 self.assertEqual(hash(value), object.__hash__(value))
2000
2001 def test_min_and_max_methods(self):
2002 Decimal = self.decimal.Decimal

Callers

nothing calls this directly

Calls 5

DecimalClass · 0.85
DClass · 0.70
assertRaisesMethod · 0.45
assertEqualMethod · 0.45
__hash__Method · 0.45

Tested by

no test coverage detected