From fb0742fe4f5d07b21764479c3c90ce6c4e1e256f Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Fri, 22 Feb 2008 17:43:17 +0000 Subject: [PATCH] Tests for bin() builtin. These need to get merged into py3k, which has no tests for bin. --- Lib/test/test_builtin.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 36b84d88193..4057ba1c963 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -2068,6 +2068,15 @@ class BuiltinTest(unittest.TestCase): class DerivedFromStr(str): pass self.assertEqual(format(0, DerivedFromStr('10')), ' 0') + def test_bin(self): + self.assertEqual(bin(0), '0b0') + self.assertEqual(bin(1), '0b1') + self.assertEqual(bin(-1), '-0b1') + self.assertEqual(bin(2**65), '0b1' + '0' * 65) + self.assertEqual(bin(2**65-1), '0b' + '1' * 65) + self.assertEqual(bin(-(2**65)), '-0b1' + '0' * 65) + self.assertEqual(bin(-(2**65-1)), '-0b' + '1' * 65) + class TestSorted(unittest.TestCase): def test_basic(self):