Index: Lib/test/test_index.py =================================================================== --- Lib/test/test_index.py (revision 79486) +++ Lib/test/test_index.py (working copy) @@ -39,6 +39,8 @@ self.assertEqual(-7 .__index__(), -7) self.assertEqual(self.o.__index__(), 4) self.assertEqual(self.n.__index__(), 5) + self.assertEqual(True.__index__(), 1) + self.assertEqual(False.__index__(), 0) def test_subclasses(self): r = list(range(10)) Index: Lib/test/test_decimal.py =================================================================== --- Lib/test/test_decimal.py (revision 79486) +++ Lib/test/test_decimal.py (working copy) @@ -472,6 +472,12 @@ self.assertRaises(ValueError, Decimal, (1, (4, 10, 4, 9, 1), 2) ) self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, 'a', 1), 2) ) + def test_explicit_from_bool(self): + self.assertIs(bool(Decimal(0)), False) + self.assertIs(bool(Decimal(1)), True) + self.assertEqual(Decimal(False), Decimal(0)) + self.assertEqual(Decimal(True), Decimal(1)) + def test_explicit_from_Decimal(self): #positive Index: Lib/test/test_bool.py =================================================================== --- Lib/test/test_bool.py (revision 79486) +++ Lib/test/test_bool.py (working copy) @@ -44,6 +44,12 @@ self.assertIsNot(int(False), False) self.assertEqual(int(True), 1) self.assertIsNot(int(True), True) + + def test_float(self): + self.assertEqual(float(False), 0.0) + self.assertIsNot(float(False), False) + self.assertEqual(float(True), 1.0) + self.assertIsNot(float(True), True) def test_math(self): self.assertEqual(+False, 0) @@ -234,6 +240,11 @@ self.assertIs(f.closed, True) finally: os.remove(support.TESTFN) + def test_types(self): + # types are always true. + for t in [bool, complex, dict, float, int, list, object, + set, str, tuple, type]: + self.assertIs(bool(t), True) def test_operator(self): import operator