def test_append(self): bytes_list = BytesList() bytes_list.append(b"some string") self.assertEqual(bytes_list, [b"some string"])
def test_append_with_unicode_string(self): bytes_list = BytesList() with self.assertRaises(TypeError): bytes_list.append(u"some string")
def test_setitem_using_integer(self): bytes_list = BytesList() bytes_list.append(b"some string") bytes_list[0] = b"another string" self.assertEqual(bytes_list[0], b"another string")
def test_append_with_non_string(self): bytes_list = BytesList() with self.assertRaises(TypeError): bytes_list.append(NON_STRING_VALUE)