Merged revisions 80123-80124 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80123 | benjamin.peterson | 2010-04-16 17:24:16 -0500 (Fri, 16 Apr 2010) | 1 line

  bytearray -> type2test
........
  r80124 | benjamin.peterson | 2010-04-16 17:25:57 -0500 (Fri, 16 Apr 2010) | 1 line

  fix typo
........
This commit is contained in:
Benjamin Peterson 2010-04-16 22:35:32 +00:00
parent e3d8ced69a
commit 4c04583e79
1 changed files with 8 additions and 8 deletions

View File

@ -64,17 +64,17 @@ class BaseBytesTest(unittest.TestCase):
b = self.type2test([Indexable(), Indexable(1), Indexable(254),
Indexable(255)])
self.assertEqual(list(b), [0, 1, 254, 255])
self.assertRaises(ValueError, bytearray, [Indexable(-1)])
self.assertRaises(ValueError, bytearray, [Indexable(256)])
self.assertRaises(ValueError, self.type2test, [Indexable(-1)])
self.assertRaises(ValueError, self.type2test, [Indexable(256)])
def test_from_ssize(self):
self.assertEqual(bytearray(0), b'')
self.assertEqual(bytearray(1), b'\x00')
self.assertEqual(bytearray(5), b'\x00\x00\x00\x00\x00')
self.assertRaises(ValueError, bytearray, -1)
self.assertEqual(self.type2test(0), b'')
self.assertEqual(self.type2test(1), b'\x00')
self.assertEqual(self.type2test(5), b'\x00\x00\x00\x00\x00')
self.assertRaises(ValueError, self.type2test, -1)
self.assertEqual(bytearray('0', 'ascii'), b'0')
self.assertEqual(bytearray(b'0'), b'0')
self.assertEqual(self.type2test('0', 'ascii'), b'0')
self.assertEqual(self.type2test(b'0'), b'0')
def test_constructor_type_errors(self):
self.assertRaises(TypeError, self.type2test, 0.0)