Tests for bin() builtin. These need to get merged into py3k, which has no tests for bin.

This commit is contained in:
Eric Smith 2008-02-22 17:43:17 +00:00
parent 3cd8194b9c
commit fb0742fe4f
1 changed files with 9 additions and 0 deletions

View File

@ -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):