mirror of https://github.com/python/cpython
Tests for bin() builtin. These need to get merged into py3k, which has no tests for bin.
This commit is contained in:
parent
3cd8194b9c
commit
fb0742fe4f
|
@ -2068,6 +2068,15 @@ class BuiltinTest(unittest.TestCase):
|
||||||
class DerivedFromStr(str): pass
|
class DerivedFromStr(str): pass
|
||||||
self.assertEqual(format(0, DerivedFromStr('10')), ' 0')
|
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):
|
class TestSorted(unittest.TestCase):
|
||||||
|
|
||||||
def test_basic(self):
|
def test_basic(self):
|
||||||
|
|
Loading…
Reference in New Issue