summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bool.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-03-30 18:56:19 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-03-30 18:56:19 (GMT)
commit503ab33e54f5edb3c8b925c0d7b22c892084c5db (patch)
treec2384275002fd30736f559d6d5f0a091663a6401 /Lib/test/test_bool.py
parent25cd7eb9a14cb646e58e315ebfafe867862a705b (diff)
downloadcpython-503ab33e54f5edb3c8b925c0d7b22c892084c5db.zip
cpython-503ab33e54f5edb3c8b925c0d7b22c892084c5db.tar.gz
cpython-503ab33e54f5edb3c8b925c0d7b22c892084c5db.tar.bz2
Merged revisions 79502 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79502 | antoine.pitrou | 2010-03-30 20:49:45 +0200 (mar., 30 mars 2010) | 4 lines Issue #8248: Add some tests for the bool type. Patch by Gregory Nofi. ........
Diffstat (limited to 'Lib/test/test_bool.py')
-rw-r--r--Lib/test/test_bool.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py
index a62ff8e..7282c0a 100644
--- a/Lib/test/test_bool.py
+++ b/Lib/test/test_bool.py
@@ -45,6 +45,12 @@ class BoolTest(unittest.TestCase):
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)
self.assertIsNot(+False, False)
@@ -235,6 +241,12 @@ class BoolTest(unittest.TestCase):
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
self.assertIs(operator.truth(0), False)