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

Method test_containers

Lib/test/test_decimal.py:4100–4119  ·  view source on GitHub ↗
(c, signal=None)

Source from the content-addressed store, hash-verified

4098 assert_attr(Decimal('NaN'), float('nan'), '__ne__', c, None)
4099
4100 def test_containers(c, signal=None):
4101 c.clear_flags()
4102 s = set([100.0, Decimal('100.0')])
4103 self.assertEqual(len(s), 1)
4104 self.assertTrue(c.flags[FloatOperation])
4105
4106 c.clear_flags()
4107 if signal:
4108 self.assertRaises(signal, sorted, [1.0, Decimal('10.0')])
4109 else:
4110 s = sorted([10.0, Decimal('10.0')])
4111 self.assertTrue(c.flags[FloatOperation])
4112
4113 c.clear_flags()
4114 b = 10.0 in [Decimal('10.0'), 1.0]
4115 self.assertTrue(c.flags[FloatOperation])
4116
4117 c.clear_flags()
4118 b = 10.0 in {Decimal('10.0'):'a', 1.0:'b'}
4119 self.assertTrue(c.flags[FloatOperation])
4120
4121 nc = Context()
4122 with localcontext(nc) as c:

Callers

nothing calls this directly

Calls 6

setFunction · 0.85
DecimalClass · 0.85
clear_flagsMethod · 0.80
assertTrueMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected